/*
  Kindred — CSS
  Design philosophy: Clean, functional, warm. Early-2000s Match.com energy
  but modernized. No dark patterns, no flashy animations, no dopamine traps.

  Colors: warm neutrals with a calm blue accent.
  Typography: system fonts for speed, generous line heights for readability.
*/

/* ============================================
   RESET & BASE
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #faf8f5;
    --color-surface: #ffffff;
    --color-text: #2c2c2c;
    --color-text-light: #666;
    --color-text-muted: #999;
    --color-primary: #4a7c8a;
    --color-primary-dark: #3a6270;
    --color-primary-light: #e8f2f5;
    --color-accent: #c7654a;
    --color-accent-light: #fdf0ec;
    --color-success: #5a8a5e;
    --color-success-light: #eef5ef;
    --color-border: #e0dcd6;
    --color-border-light: #f0ece6;
    --color-heart: #c7654a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --max-width: 960px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* ============================================
   HEADER
   ============================================ */

#site-header {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--color-primary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-icon {
    color: var(--color-heart);
    font-size: 1.3rem;
}

.tagline {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-right: auto;
}

#main-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

#main-nav a {
    text-decoration: none;
    color: var(--color-text-light);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

#main-nav a:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

#main-nav .nav-deactivate {
    color: var(--color-success);
    font-weight: 600;
}

#main-nav .nav-deactivate:hover {
    background: var(--color-success-light);
}

#main-nav .nav-logout {
    color: var(--color-text-muted);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

main {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: var(--color-surface);
    border-top: 2px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.footer-note {
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

/* ============================================
   CARDS & PANELS
   ============================================ */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.card-highlight {
    border-left: 4px solid var(--color-primary);
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.panel-header {
    background: var(--color-primary);
    color: white;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.panel-body {
    padding: 1.5rem;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.subtitle {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.text-muted {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.text-success {
    color: var(--color-success);
}

.text-accent {
    color: var(--color-accent);
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: var(--color-text);
}

.form-group .hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.form-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1rem;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: var(--color-border-light);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border);
}

.btn-accent {
    background: var(--color-accent);
    color: white;
}

.btn-accent:hover {
    background: #b55a42;
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: #4a7a4e;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary-light);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================
   MATCH CARDS
   ============================================ */

.match-list {
    display: grid;
    gap: 1rem;
}

.match-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    padding: 1.25rem;
    transition: box-shadow 0.15s;
    align-items: start;
}

.match-card:hover {
    box-shadow: var(--shadow-md);
}

.match-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.match-photo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.match-info h3 {
    margin-bottom: 0.15rem;
}

.match-info .match-meta {
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.match-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.trait-tag {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
}

.match-score {
    text-align: center;
    flex-shrink: 0;
}

.score-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.score-high { background: var(--color-success); }
.score-medium { background: var(--color-primary); }
.score-low { background: var(--color-text-muted); }

.score-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   COMPATIBILITY BREAKDOWN
   ============================================ */

.compat-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.compat-category {
    text-align: center;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.compat-category .category-name {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.compat-category .category-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.compat-bar {
    height: 6px;
    background: var(--color-border-light);
    border-radius: 3px;
    margin-top: 0.35rem;
    overflow: hidden;
}

.compat-bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ============================================
   PROFILE VIEW
   ============================================ */

.profile-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.profile-photo-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    overflow: hidden;
}

.profile-photo-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-details h1 {
    margin-bottom: 0.25rem;
}

.profile-location {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.profile-goal {
    display: inline-block;
    background: var(--color-accent-light);
    color: var(--color-accent);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}

.profile-section {
    margin-bottom: 1.5rem;
}

.profile-section h3 {
    color: var(--color-primary);
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: 0.35rem;
    margin-bottom: 0.75rem;
}

.lifestyle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.lifestyle-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.9rem;
}

.lifestyle-item .label {
    color: var(--color-text-muted);
}

.lifestyle-item .value {
    font-weight: 500;
}

/* ============================================
   MESSAGING
   ============================================ */

.conversation-list {
    display: grid;
    gap: 0.5rem;
}

.conversation-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    align-items: center;
}

.conversation-item:hover {
    background: var(--color-bg);
}

.convo-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--color-text-muted);
    overflow: hidden;
}

.convo-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.convo-preview .convo-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.convo-preview .convo-last {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.convo-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
}

.message-mine {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-theirs {
    align-self: flex-start;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    margin-top: 0.25rem;
    opacity: 0.7;
}

.message-input-area {
    display: flex;
    gap: 0.5rem;
}

.message-input-area textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
}

/* ============================================
   LANDING / AUTH PAGES
   ============================================ */

.landing-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.landing-hero h1 {
    font-size: 2.2rem;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
}

.landing-hero .hero-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-light);
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.landing-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.value-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.value-card .value-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.value-card h3 {
    color: var(--color-primary);
    margin-bottom: 0.35rem;
}

.value-card p {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.landing-essay {
    max-width: 640px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.landing-essay h2 {
    font-size: 1.6rem;
    margin-bottom: 1.25rem;
    color: var(--color-text);
}

.landing-essay p {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text-light);
    margin-bottom: 1.1rem;
}

.landing-essay p:last-child {
    margin-bottom: 0;
}

.essay-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
    text-decoration: none;
}

.essay-link:hover {
    text-decoration: underline;
}

.auth-container {
    max-width: 440px;
    margin: 0 auto;
}

.auth-toggle {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.auth-toggle a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fdf0ec;
    color: #b5422a;
    border: 1px solid #f0c4b8;
}

.alert-success {
    background: var(--color-success-light);
    color: #3a6a3e;
    border: 1px solid #c0d8c2;
}

.alert-info {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border: 1px solid #c0d8de;
}

/* ============================================
   INTERESTS PAGE
   ============================================ */

.interest-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-border);
}

.interest-tab {
    padding: 0.6rem 1.25rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
}

.interest-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ============================================
   SUCCESS STORIES
   ============================================ */

.story-card {
    background: var(--color-success-light);
    border: 1px solid #c0d8c2;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.story-card .story-names {
    font-weight: 700;
    color: var(--color-success);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.story-card .story-text {
    color: var(--color-text);
    line-height: 1.7;
}

.story-card .story-date {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ============================================
   DEACTIVATE PAGE
   ============================================ */

.deactivate-page {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.deactivate-page h1 {
    color: var(--color-success);
}

.deactivate-page .celebration {
    font-size: 3rem;
    margin: 1rem 0;
}

/* ============================================
   TIME REMINDER (anti-addiction)
   ============================================ */

#time-reminder {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    max-width: 320px;
    z-index: 200;
}

#time-reminder .reminder-content {
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text);
}

#time-reminder button {
    margin-top: 0.75rem;
    padding: 0.4rem 1rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

/* ============================================
   SEARCH / FILTERS
   ============================================ */

.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.filter-bar .form-group {
    margin-bottom: 0;
    min-width: 120px;
}

.filter-bar label {
    font-size: 0.75rem;
}

.filter-bar input,
.filter-bar select {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

/* ============================================
   SETUP WIZARD
   ============================================ */

.setup-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.setup-step {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
}

.setup-step.active {
    background: var(--color-primary);
    width: 30px;
    border-radius: 5px;
}

.setup-step.done {
    background: var(--color-success);
}

/* ============================================
   WHY MATCHED
   ============================================ */

.why-matched {
    margin-top: 0.5rem;
}

.why-matched li {
    font-size: 0.85rem;
    color: var(--color-success);
    padding: 0.15rem 0;
    list-style: none;
}

.why-matched li::before {
    content: "\2713 ";
    font-weight: 700;
}

/* ============================================
   LOADING
   ============================================ */

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   UNIT TOGGLE & PHYSICAL PREFS
   ============================================ */

.unit-toggle {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.unit-toggle label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text-muted);
}

.unit-toggle input[type="radio"]:checked + span,
.unit-toggle label:has(input:checked) {
    color: var(--color-primary);
}

.optional {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1rem;
    margin-top: 0.4rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .tagline {
        display: none;
    }

    #main-nav {
        width: 100%;
        justify-content: flex-start;
    }

    .match-card {
        grid-template-columns: auto 1fr;
    }

    .match-score {
        grid-column: 1 / -1;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .landing-hero h1 {
        font-size: 1.6rem;
    }

    .filter-bar {
        flex-direction: column;
    }
}
