/* ============================================================
   ShabdSetu – Apple-Style Design System
   Clean, Minimal, Premium
   ============================================================ */

/* ==================== DESIGN TOKENS ==================== */
:root {
    /* Primary Palette – Deep Ink & Soft Neutrals */
    --primary: #1d1d1f;
    --primary-light: #424245;
    --secondary: #f5f5f7;
    --text-secondary: #86868b;

    /* Accent Palette – Refined & Harmonious */
    --accent-blue: #0071e3;
    --accent-blue-hover: #0077ed;
    --accent-green: #34c759;
    --accent-purple: #af52de;
    --accent-amber: #ff9f0a;
    --accent-red: #ff3b30;

    /* Semantic Colors */
    --success: #34c759;
    --warning: #ff9f0a;
    --error: #ff3b30;

    /* Surface & Layout */
    --gray: #86868b;
    --gray-light: #6e6e73;
    --light: #ffffff;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.12);
    --background: #ffffff;
    --background-secondary: #f5f5f7;
    --card-bg: #ffffff;

    /* Elevation – Soft, Diffused Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.10), 0 8px 20px rgba(0, 0, 0, 0.06);

    /* Motion */
    --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.2s;
    --duration-base: 0.35s;
    --duration-slow: 0.5s;

    /* Typography Scale */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'DM Sans', 'Inter', -apple-system, sans-serif;

    /* Border Radius Scale */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
}

/* ==================== DARK THEME ==================== */
[data-theme="dark"] {
    --primary: #f5f5f7;
    --primary-light: #d2d2d7;
    --secondary: #1d1d1f;
    --text-secondary: #86868b;

    --accent-blue: #2997ff;
    --accent-blue-hover: #40a9ff;
    --accent-green: #30d158;
    --accent-purple: #bf5af2;
    --accent-amber: #ffd60a;
    --accent-red: #ff453a;

    --success: #30d158;
    --warning: #ffd60a;
    --error: #ff453a;

    --gray: #98989d;
    --gray-light: #8e8e93;
    --light: #ffffff;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --background: #000000;
    --background-secondary: #1c1c1e;
    --card-bg: #1c1c1e;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background: var(--background);
    min-height: 100vh;
    padding-top: 5rem;
    color: var(--primary);
    letter-spacing: -0.011em;
    line-height: 1.5;
    font-size: 1rem;
    transition: background var(--duration-base) var(--ease-smooth),
                color var(--duration-base) var(--ease-smooth);
}

::selection {
    background: rgba(0, 113, 227, 0.15);
    color: var(--primary);
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

.main-content {
    padding: 2rem 0;
}

/* ==================== HEADER ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    transition: all var(--duration-base) var(--ease-smooth);
}

[data-theme="dark"] .header {
    background: rgba(0, 0, 0, 0.72);
}

.header-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}

/* ==================== LOGO ==================== */
.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--primary);
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    z-index: 101;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--duration-base) var(--ease-smooth);
}

.logo:hover .logo-icon {
    transform: scale(1.05);
}

.logo-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* ==================== NAVIGATION ==================== */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.nav-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    transition: color var(--duration-fast) ease,
                opacity var(--duration-fast) ease;
    white-space: nowrap;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    opacity: 0.8;
}

.nav-link:hover {
    opacity: 1;
}

/* Auth Button Styles */
.nav-auth-btn {
    padding: 0.375rem 1rem !important;
    border-radius: var(--radius-full) !important;
    font-weight: 500 !important;
    font-size: 0.8125rem !important;
    transition: all var(--duration-base) var(--ease-smooth) !important;
    opacity: 1 !important;
}

.login-btn {
    background: var(--accent-blue);
    color: white !important;
}

.login-btn:hover {
    background: var(--accent-blue-hover);
    transform: none;
    box-shadow: none;
    color: white !important;
}

.logout-btn {
    background: var(--error);
    color: white !important;
}

.logout-btn:hover {
    opacity: 0.9;
    transform: none;
    box-shadow: none;
    color: white !important;
}

/* ==================== HEADER ACTIONS ==================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== THEME TOGGLE ==================== */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) ease;
}

.theme-toggle:hover {
    background: var(--background-secondary);
    color: var(--primary);
}

.theme-toggle svg {
    width: 17px;
    height: 17px;
    transition: transform var(--duration-base) var(--ease-smooth);
}

.theme-toggle:hover svg {
    transform: rotate(20deg);
}

/* Light mode (default): show moon icon, hide sun */
.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

/* Dark mode: show sun icon, hide moon */
[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

/* ==================== MOBILE TOGGLE ==================== */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0.375rem;
    z-index: 101;
}

.mobile-toggle svg {
    width: 22px;
    height: 22px;
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--background-secondary);
    border-top: 1px solid var(--border);
    padding: 2.5rem 1.5rem 1.5rem;
    margin-top: 4rem;
}

.footer-tagline {
    color: var(--gray);
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.875rem;
    color: var(--primary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: var(--gray);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color var(--duration-fast) ease;
}

.footer-section ul li a:hover {
    color: var(--accent-blue);
}

.footer-bottom {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-bottom p {
    color: var(--gray);
    font-size: 0.75rem;
}

/* ==================== AMBIENT BACKGROUND ==================== */
.ambient-glow {
    position: fixed;
    top: -30%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(0, 113, 227, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: ambientDrift 25s ease-in-out infinite alternate;
}

.ambient-glow-2 {
    position: fixed;
    bottom: -30%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(175, 82, 222, 0.025) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: ambientDrift2 30s ease-in-out infinite alternate;
}

@keyframes ambientDrift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(5%, 10%); }
}

@keyframes ambientDrift2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-5%, -8%); }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Apple-style subtle pulse for loading states */
@keyframes subtlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: var(--font-sans);
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--accent-blue);
    color: var(--light);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-blue-hover);
    transform: scale(1.02);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-success {
    background: var(--accent-green);
    color: var(--light);
}

.btn-success:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

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

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

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

/* Tablet */
@media (min-width: 768px) {
    body {
        padding-top: 5rem;
    }

    .main-content {
        padding: 2.5rem 0;
    }

    .header-container {
        height: 52px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    body {
        padding-top: 5rem;
    }

    .main-content {
        padding: 3rem 0;
    }

    .nav-menu {
        display: flex;
    }
}

/* Mobile Menu */
@media (max-width: 1023px) {
    .nav-menu {
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        gap: 0;
        padding: 0.75rem 1.5rem;
        display: none;
        box-shadow: var(--shadow-lg);
    }

    [data-theme="dark"] .nav-menu {
        background: rgba(28, 28, 30, 0.98);
    }

    .nav-menu.active {
        display: flex;
        animation: fadeIn 0.2s var(--ease-smooth);
    }

    .nav-link {
        padding: 0.75rem 1rem;
        width: 100%;
        text-align: left;
        border-radius: var(--radius-md);
        opacity: 1;
        font-size: 0.9375rem;
    }

    .nav-link:hover {
        background: var(--background-secondary);
    }

    .mobile-toggle {
        display: block;
    }
}
