/**
 * SPAR-Kit — Premium Design System v2.0
 * நாலு பேரு, நாலு திசை, ஒரு முடிவு
 * Four Perspectives, Four Dimensions, One Synthesis
 */

/* ============================================
   CSS VARIABLES — Design Tokens
   ============================================ */

:root {
    /* Core Colors — Panchabhootam Elements */
    --north: #60a5fa;    /* Air — Vision */
    --east: #4ade80;     /* Fire — Growth */
    --south: #fbbf24;    /* Earth — Stability */
    --west: #f87171;     /* Water — Wisdom */
    --center: #a78bfa;   /* Aether — Synthesis */

    /* Neutrals */
    --void: #0a0a0f;
    --nebula: #12121a;
    --meteor: #1e1e2e;
    --fog: #2d2d3d;
    --smoke: #6b7280;
    --mist: #9ca3af;
    --cloud: #d1d5db;
    --pure: #ffffff;

    /* Accent */
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-dark: #7c3aed;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-tamil: 'Noto Sans Tamil', var(--font-sans);
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);

    /* Transitions */
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--void);
    color: var(--cloud);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color var(--duration-fast);
}

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

/* ============================================
   BACKGROUND PATTERN
   ============================================ */

.bg-pattern {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(96, 165, 250, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(74, 222, 128, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   CONTAINER
   ============================================ */

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

.container-narrow {
    max-width: 800px;
}

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

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--fog);
    padding: var(--space-3) 0;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--pure);
}

.nav-logo-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: var(--space-6);
}

.nav-link {
    color: var(--mist);
    font-weight: 500;
    font-size: 0.9rem;
    padding: var(--space-2) 0;
    position: relative;
    transition: color var(--duration-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--pure);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: var(--radius-full);
}

.nav-cta {
    background: var(--accent);
    color: var(--pure);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--duration-fast);
}

.nav-cta:hover {
    background: var(--accent-light);
    color: var(--pure);
    transform: translateY(-1px);
}

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

.hero {
    padding: calc(80px + var(--space-12)) 0 var(--space-12);
    text-align: center;
}

.hero-logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.hero-logo-icon {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero-logo-text {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--pure), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: 1.5rem;
    color: var(--mist);
    margin-bottom: var(--space-2);
}

.hero-tagline-tamil {
    font-family: var(--font-tamil);
    font-size: 1.75rem;
    color: var(--accent-light);
    margin-bottom: var(--space-8);
}

.hero-cta {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--pure);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

.btn-secondary {
    background: var(--meteor);
    color: var(--cloud);
    border: 1px solid var(--fog);
}

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

.btn-ghost {
    background: transparent;
    color: var(--mist);
}

.btn-ghost:hover {
    color: var(--pure);
    background: rgba(255, 255, 255, 0.05);
}

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

.card {
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-glass {
    background: rgba(18, 18, 26, 0.7);
    backdrop-filter: blur(20px);
}

/* ============================================
   SECTION TITLES
   ============================================ */

.section {
    padding: var(--space-12) 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-8);
    text-align: center;
}

.section-subtitle {
    color: var(--mist);
    font-size: 1.125rem;
    text-align: center;
    margin-top: calc(-1 * var(--space-6));
    margin-bottom: var(--space-8);
}

/* ============================================
   INSIGHT CARDS (4 Cards Grid)
   ============================================ */

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-6);
}

.insight-card {
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--duration-normal) var(--ease-out);
}

.insight-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.insight-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.insight-card p {
    color: var(--mist);
    font-size: 0.95rem;
}

/* ============================================
   VIEW MODE TOGGLE
   ============================================ */

.view-toggle {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-1);
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    justify-content: center;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--mist);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.view-btn:hover {
    color: var(--pure);
    background: rgba(255, 255, 255, 0.05);
}

.view-btn.active {
    background: var(--accent);
    color: var(--pure);
}

.view-btn .count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ============================================
   COMPASS VIEW (4 Directions)
   ============================================ */

.compass-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    max-width: 600px;
    margin: 0 auto;
}

.compass-card {
    background: var(--nebula);
    border: 2px solid var(--fog);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    cursor: pointer;
    transition: all var(--duration-fast);
    text-align: center;
}

.compass-card:hover {
    transform: scale(1.02);
}

.compass-card.north { border-color: var(--north); }
.compass-card.east { border-color: var(--east); }
.compass-card.south { border-color: var(--south); }
.compass-card.west { border-color: var(--west); }

.compass-card.selected {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent);
}

.compass-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
}

.compass-direction {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: var(--space-1);
}

.compass-name {
    color: var(--mist);
    font-size: 0.875rem;
}

/* ============================================
   ARCHETYPE GRID (11 Archetypes)
   ============================================ */

.archetype-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}

.archetype-card {
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.archetype-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.archetype-letter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0 auto var(--space-2);
    color: var(--pure);
}

.archetype-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--space-1);
}

.archetype-count {
    color: var(--smoke);
    font-size: 0.75rem;
}

/* Archetype Colors */
.archetype-P .archetype-letter { background: #ef4444; }
.archetype-E .archetype-letter { background: #22c55e; }
.archetype-R .archetype-letter { background: #f59e0b; }
.archetype-S .archetype-letter { background: #3b82f6; }
.archetype-O .archetype-letter { background: #8b5cf6; }
.archetype-N .archetype-letter { background: #06b6d4; }
.archetype-A .archetype-letter { background: #ec4899; }
.archetype-L .archetype-letter { background: #d97706; }
.archetype-I .archetype-letter { background: #14b8a6; }
.archetype-T .archetype-letter { background: #64748b; }
.archetype-Y .archetype-letter { background: #a855f7; }

/* ============================================
   PERSONA LIBRARY
   ============================================ */

.search-box {
    position: relative;
    margin-bottom: var(--space-4);
}

.search-box input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    padding-left: calc(var(--space-4) + 1.5rem);
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-md);
    color: var(--cloud);
    font-size: 1rem;
    transition: border-color var(--duration-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}

.persona-card {
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.persona-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.persona-name {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.persona-focus {
    color: var(--mist);
    font-size: 0.875rem;
}

/* ============================================
   BYOK MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 480px;
    width: 90%;
    transform: translateY(20px);
    transition: transform var(--duration-normal) var(--ease-out);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-6);
    text-align: center;
}

.modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: none;
    border: none;
    color: var(--mist);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-2);
    color: var(--cloud);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--meteor);
    border: 1px solid var(--fog);
    border-radius: var(--radius-md);
    color: var(--cloud);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: border-color var(--duration-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--smoke);
    margin-top: var(--space-2);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* ============================================
   WIZARD STEPS
   ============================================ */

.wizard {
    max-width: 800px;
    margin: 0 auto;
}

.wizard-step {
    background: var(--nebula);
    border: 1px solid var(--fog);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    overflow: hidden;
    transition: all var(--duration-fast);
}

.wizard-step.active {
    border-color: var(--accent);
}

.wizard-step.locked {
    opacity: 0.6;
}

.wizard-step-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
}

.wizard-step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fog);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.wizard-step.active .wizard-step-number {
    background: var(--accent);
}

.wizard-step.completed .wizard-step-number {
    background: var(--east);
}

.wizard-step-info {
    flex: 1;
}

.wizard-step-name {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.wizard-step-desc {
    font-size: 0.875rem;
    color: var(--mist);
}

.wizard-step-status {
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--fog);
    color: var(--mist);
}

.wizard-step.active .wizard-step-status {
    background: var(--accent);
    color: var(--pure);
}

.wizard-step-content {
    padding: 0 var(--space-5) var(--space-5);
    display: none;
}

.wizard-step.active .wizard-step-content {
    display: block;
}

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

.footer {
    border-top: 1px solid var(--fog);
    padding: var(--space-8) 0;
    text-align: center;
    color: var(--smoke);
    font-size: 0.875rem;
}

.footer a {
    color: var(--mist);
}

.footer a:hover {
    color: var(--accent);
}

/* ============================================
   RESPONSIVE — Mobile First Approach
   ============================================ */

/* Hamburger Menu Button */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--pure);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-2);
    z-index: 1001;
}

/* Mobile Menu Overlay */
.nav-links-mobile {
    display: none;
}

/* Mobile: 768px and below */
@media (max-width: 768px) {
    /* Show hamburger, hide desktop nav */
    .nav-hamburger {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 10, 15, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-8);
        transform: translateX(-100%);
        transition: transform var(--duration-normal) var(--ease-out);
        z-index: 1000;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-link {
        font-size: 1.5rem;
    }

    .nav-cta {
        display: none;
    }

    .nav-cta.mobile {
        display: block;
        position: fixed;
        bottom: var(--space-6);
        left: var(--space-4);
        right: var(--space-4);
        text-align: center;
        z-index: 1001;
    }

    /* Hero adjustments */
    .hero {
        padding: calc(70px + var(--space-8)) var(--space-4) var(--space-8);
    }

    .hero-logo-icon {
        font-size: 2.5rem;
    }

    .hero-logo-text {
        font-size: 2.5rem;
    }

    .hero-tagline {
        font-size: 1.1rem;
    }

    .hero-tagline-tamil {
        font-size: 1rem;
    }

    .hero-cta {
        flex-direction: column;
        gap: var(--space-3);
    }

    .hero-cta .btn {
        width: 100%;
        justify-content: center;
    }

    /* Section titles */
    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    /* Compass grid */
    .compass-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    /* Modal improvements */
    .modal {
        padding: var(--space-5);
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Container padding */
    .container {
        padding: 0 var(--space-4);
    }

    /* SPAR Acronym Grid */
    .spar-acronym-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-3) !important;
    }

    .spar-acronym-grid .card {
        padding: var(--space-4);
    }

    .spar-acronym-grid .card > div:first-child {
        font-size: 2rem !important;
    }

    /* Provider grid */
    .provider-grid {
        flex-direction: column !important;
        gap: var(--space-6) !important;
    }

    .provider-grid > div {
        flex: 1;
    }

    /* Insight grid */
    .insight-grid {
        grid-template-columns: 1fr;
    }

    /* View toggle improvements */
    .view-toggle {
        flex-direction: row;
        flex-wrap: wrap;
        padding: var(--space-2);
    }

    .view-btn {
        flex: 1 1 45%;
        justify-content: center;
        padding: var(--space-3);
    }

    /* Example questions */
    .example-question {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
        padding: var(--space-4);
    }

    .example-tag {
        order: -1;
    }

    .example-text {
        font-size: 0.9rem;
    }

    .copy-icon {
        align-self: flex-end;
    }

    /* Archetype grid */
    .archetype-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
    }

    .archetype-card {
        padding: var(--space-3);
    }

    .archetype-letter {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .archetype-name {
        font-size: 0.8rem;
    }

    .archetype-count {
        font-size: 0.7rem;
    }

    /* Persona grid */
    .persona-grid {
        grid-template-columns: 1fr;
    }

    /* Wizard steps */
    .wizard-step-header {
        padding: var(--space-3) var(--space-4);
    }

    .wizard-step-content {
        padding: 0 var(--space-4) var(--space-4);
    }

    /* Two-column card layouts */
    .two-col-cards {
        grid-template-columns: 1fr !important;
    }

    /* Footer */
    .footer {
        padding: var(--space-6) var(--space-4);
    }
}

/* Extra small: 480px and below */
@media (max-width: 480px) {
    .hero-logo-icon {
        font-size: 2rem;
    }

    .hero-logo-text {
        font-size: 2rem;
    }

    .hero-tagline {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    /* SPAR Acronym Grid - single column */
    .spar-acronym-grid {
        grid-template-columns: 1fr !important;
    }

    /* Archetype grid - 2 columns */
    .archetype-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* View toggle - stack vertically */
    .view-btn {
        flex: 1 1 100%;
    }

    /* Modal full width */
    .modal {
        width: 95%;
        padding: var(--space-4);
        border-radius: var(--radius-md);
    }

    /* Buttons full width */
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-center { text-align: center; }
.text-mist { color: var(--mist); }
.text-accent { color: var(--accent-light); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.hidden { display: none !important; }

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn var(--duration-normal) var(--ease-out);
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    .btn, .nav-link, .view-btn, .compass-card, .archetype-card, .persona-card {
        min-height: 44px;
    }
}

