/**
 * MartialLineage.org - Main Stylesheet
 *
 * Design: Warm gold/tan/cream palette inspired by heritage & tradition.
 * Elegant, understated, community/heritage-focused.
 */

/* ========================================
   CSS VARIABLES
   ======================================== */

:root {
    /* Gold/Tan Palette */
    --gold: #C4A265;
    --gold-light: #D4B87A;
    --gold-dark: #A68945;
    --gold-muted: #B8A47A;

    /* Warm Neutrals */
    --cream: #FAF6F0;
    --cream-dark: #F0EBE2;
    --parchment: #EDE7DC;
    --warm-white: #FEFCF9;
    --warm-gray: #9E9688;
    --warm-gray-dark: #6B645B;

    /* Text */
    --text-primary: #2C2924;
    --text-secondary: #5A544B;
    --text-muted: #8C857B;
    --text-light: #B5AFA6;

    /* Functional */
    --success: #5B8C3E;
    --error: #C75B39;
    --warning: #D4963A;
    --info: #4A7BC7;

    /* Surfaces */
    --card-bg: #FFFFFF;
    --card-border: #E8E2D8;
    --card-shadow: rgba(44, 41, 36, 0.08);

    /* Layout */
    --nav-height: 64px;
    --container-max: 1200px;
    --radius: 8px;
    --radius-lg: 12px;
}

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

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

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

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

a {
    color: var(--gold-dark);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--gold);
}

img { max-width: 100%; height: auto; }

/* ========================================
   LAYOUT
   ======================================== */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-gold { color: var(--gold); }
.link-gold { color: var(--gold-dark); font-weight: 500; }
.link-gold:hover { color: var(--gold); }

/* ========================================
   NAVIGATION
   ======================================== */

.main-nav {
    background: var(--warm-white);
    border-bottom: 1px solid var(--card-border);
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 32px;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.nav-brand:hover { color: var(--text-primary); }

.nav-links {
    display: flex;
    gap: 24px;
    flex: 1;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 4px 0;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--gold-dark);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-search {
    position: relative;
}

.search-input {
    background: var(--cream);
    border: 1.5px solid var(--gold-muted);
    border-radius: 20px;
    padding: 8px 16px 8px 36px;
    font-size: 0.875rem;
    color: var(--text-primary);
    width: 200px;
    transition: border-color 0.2s, width 0.3s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239E9688' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.search-input:focus {
    outline: none;
    border-color: var(--gold);
    width: 260px;
}

.search-input::placeholder {
    color: var(--text-light);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    color: var(--warm-white);
    box-shadow: 0 2px 4px rgba(196, 162, 101, 0.3);
}

.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--warm-white);
    box-shadow: 0 4px 8px rgba(196, 162, 101, 0.4);
    transform: translateY(-1px);
}

.btn-outline-gold {
    background: transparent;
    color: var(--gold-dark);
    border: 1.5px solid var(--gold-muted);
}

.btn-outline-gold:hover {
    background: var(--gold);
    color: var(--warm-white);
    border-color: var(--gold);
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero-section {
    background: linear-gradient(180deg, var(--warm-white) 0%, var(--cream) 100%);
    padding: 48px 0 40px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    align-items: start;
}

.hero-label {
    display: inline-block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.2;
}

/* Tree Preview */
.tree-preview {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    min-height: 280px;
    box-shadow: 0 4px 16px var(--card-shadow);
}

.tree-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tree-node-row {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.tree-node {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    box-shadow: 0 2px 8px rgba(196, 162, 101, 0.3);
}

.tree-node.small {
    width: 32px;
    height: 32px;
}

.tree-connector {
    width: 2px;
    height: 12px;
    background: var(--gold-muted);
    opacity: 0.5;
}

/* Sidebar */
.hero-sidebar {
    position: sticky;
    top: calc(var(--nav-height) + 16px);
}

.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 4px 16px var(--card-shadow);
}

.sidebar-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.trending-list {
    list-style: none;
}

.trending-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--cream-dark);
    cursor: pointer;
    transition: color 0.2s;
}

.trending-list li:last-child {
    border-bottom: none;
}

.trending-list li:hover {
    color: var(--gold-dark);
}

.style-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========================================
   LINEAGE CARDS
   ======================================== */

.lineage-cards-section {
    padding: 48px 0 64px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.lineage-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 2px 8px var(--card-shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.lineage-card:hover {
    box-shadow: 0 8px 24px rgba(44, 41, 36, 0.12);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--parchment) 0%, var(--gold-muted) 100%);
    flex-shrink: 0;
}

.card-header strong {
    display: block;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.card-header .text-muted {
    font-size: 0.75rem;
}

.card-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   LOGIN PAGE
   ======================================== */

.login-body {
    background: linear-gradient(135deg, var(--cream-dark) 0%, var(--parchment) 50%, var(--cream) 100%);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-logo p {
    margin-top: 4px;
    color: var(--text-muted);
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 8px 32px var(--card-shadow);
}

.login-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* SSO Buttons */
.sso-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-sso {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--warm-white);
    text-decoration: none;
    transition: all 0.2s;
}

.btn-sso:hover {
    border-color: var(--gold-muted);
    background: var(--cream);
    color: var(--text-primary);
}

.login-divider {
    text-align: center;
    position: relative;
    margin: 20px 0;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--card-border);
}

.login-divider span {
    position: relative;
    background: var(--card-bg);
    padding: 0 12px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

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

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--warm-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(196, 162, 101, 0.15);
}

.form-control::placeholder {
    color: var(--text-light);
}

/* ========================================
   FLASH MESSAGES
   ======================================== */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.flash-success {
    background: #f0f9f0;
    border: 1px solid #c3e6c3;
    color: #2d6a2d;
}

.flash-error {
    background: #fef2f0;
    border: 1px solid #f0c3b8;
    color: #9e3018;
}

.flash-warning {
    background: #fef8f0;
    border: 1px solid #f0deb8;
    color: #8a6d1b;
}

.flash-info {
    background: #f0f5fe;
    border: 1px solid #b8d0f0;
    color: #1b4a8a;
}

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

.main-footer {
    background: var(--text-primary);
    color: var(--text-light);
    padding: 24px 0;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--warm-gray);
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--gold-light);
}

.footer-copy {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--warm-gray-dark);
}

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

@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-sidebar {
        position: static;
    }

    .nav-links {
        display: none;
    }

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

    .search-input {
        width: 150px;
    }

    .search-input:focus {
        width: 180px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        gap: 12px;
        padding: 0 16px;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .login-card {
        padding: 24px;
    }
}
