/* 
   SleepLe - Main Styles 
   Design System: Clean, Modern, "Medical Wellness"
*/

:root {
    /* Colors */
    --brand-blue: #243E95;
    --brand-dark: #0F172A;
    --brand-light: #E0E7FF;
    --accent-soft: #F0F9FF;

    --text-main: #1E293B;
    --text-heading: #0F172A;
    --text-muted: #64748B;
    --text-on-brand: #FFFFFF;

    --bg-white: #FFFFFF;
    --bg-soft: #F8FAFC;
    --border-light: #E2E8F0;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --container-width: 1200px;
    --header-height: 80px;
    --radius-md: 12px;
    --radius-lg: 24px;

    /* Fonts */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;

    /* Animation */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-theme="dark"] {
    --brand-blue: #60A5FA;
    --brand-dark: #0F172A;
    --brand-light: #1E293B;
    --accent-soft: #334155;

    --text-main: #F1F5F9;
    --text-heading: #F1F5F9;
    --text-muted: #94A3B8;
    --text-on-brand: #0F172A;

    --bg-white: #0F172A;
    --bg-soft: #1E293B;
    --border-light: #334155;

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.logo-text {
    color: var(--text-heading);
    line-height: 1.2;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary {
    background-color: var(--brand-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #1b2e75;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 62, 149, 0.25);
}

.btn-white {
    background-color: white;
    color: var(--brand-blue);
}

.btn-white:hover {
    background-color: #f1f5f9;
}

/* HEADER */
.site-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.3s ease;
}

[data-theme="dark"] .site-header {
    background: rgba(15, 23, 42, 0.9);
    /* Night Blue transparent */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .logo-text,
[data-theme="dark"] .nav-list a {
    color: white;
}

[data-theme="dark"] .mobile-menu-toggle span {
    background: white;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-blue);
}

.logo-icon {
    font-size: 1.8rem;
}

.nav-list {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-list a {
    font-weight: 500;
    color: var(--text-main);
}

.nav-list a:hover {
    color: var(--brand-blue);
}

.nav-cta {
    color: var(--brand-blue) !important;
    font-weight: 600;
    background: var(--brand-light);
    padding: 8px 16px;
    border-radius: 8px;
}

.nav-cta:hover {
    background: #c7d2fe;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--brand-dark);
}

.logo-svg {
    width: 32px;
    height: 32px;
    color: var(--brand-blue);
    transition: transform 0.5s ease;
}

[data-theme="dark"] .logo-svg {
    color: white;
}

.logo:hover .logo-svg {
    transform: rotate(-10deg) scale(1.1);
}

.star-anim {
    animation: twinkle 3s infinite ease-in-out;
    transform-origin: center;
}

.delay-1 {
    animation-delay: 1.5s;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* SEARCH OVERLAY */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 100px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

[data-theme="dark"] .search-overlay {
    background: rgba(15, 23, 42, 0.98);
}

.search-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.search-close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 3rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
}

.search-container {
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
}

#search-input {
    width: 100%;
    font-size: 2rem;
    font-family: var(--font-heading);
    border: none;
    border-bottom: 2px solid var(--border-light);
    background: transparent;
    padding: 16px 0;
    outline: none;
    color: var(--text-main);
}

#search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.search-results {
    margin-top: 40px;
    max-height: 60vh;
    overflow-y: auto;
}

.search-result-item {
    display: block;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
    text-decoration: none;
}

.search-result-item:hover {
    background: var(--brand-light);
}

[data-theme="dark"] .search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.result-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--brand-blue);
    margin-bottom: 4px;
}

[data-theme="dark"] .result-title {
    color: #93c5fd;
}

.result-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* MOBILE NAV OVERLAY */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: white;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

.mobile-nav-list {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mobile-nav-list a {
    font-size: 1.5rem;
    color: var(--brand-dark);
    font-weight: 600;
}

/* HERO SECTION */
.hero-section {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 80px;
    min-height: 90vh;
    display: flex;
    align-items: center;
    background: radial-gradient(circle at top right, var(--accent-soft), var(--bg-white) 60%);
    position: relative;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 48px;
    align-items: center;
}

.hero-eyebrow {
    color: var(--brand-blue);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 24px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-desc {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    max-width: 500px;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
}

.hero-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    max-width: 350px;
}

/* Hero Visual Animation */
.hero-visual {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visual-circle-1,
.visual-circle-2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    z-index: 1;
}

.visual-circle-1 {
    width: 300px;
    height: 300px;
    background: rgba(36, 62, 149, 0.1);
    top: 0;
    right: 20px;
    animation: float 8s infinite ease-in-out;
}

.visual-circle-2 {
    width: 250px;
    height: 250px;
    background: rgba(100, 116, 139, 0.1);
    bottom: 20px;
    left: 40px;
    animation: float 6s infinite ease-in-out reverse;
}

.visual-card {
    position: relative;
    z-index: 2;
    background: var(--bg-white);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    max-width: 340px;
    border: 1px solid var(--border-light);
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.visual-card:hover {
    transform: rotate(0);
}

.visual-stat {
    margin-bottom: 16px;
}

.stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: var(--brand-blue);
    line-height: 1;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-main);
}

.visual-tag {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand-blue);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* SCROLL INDICATOR */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.6;
    animation: fadeOutScroll 3s forwards;
    animation-delay: 2s;
    /* hides after some time */
}

.mouse {
    width: 26px;
    height: 42px;
    border: 2px solid var(--brand-blue);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.wheel {
    width: 4px;
    height: 8px;
    background: var(--brand-blue);
    border-radius: 2px;
    animation: scrollWheel 1.5s infinite;
}

@keyframes scrollWheel {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(12px);
        opacity: 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(15px, -15px);
    }
}

/* GENERAL SECTIONS */
.section {
    padding: 80px 0;
}

.section-header {
    margin-bottom: 48px;
    max-width: 700px;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 16px;
}

.section-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* INTRO */
.intro-section {
    background: var(--bg-white);
}

.intro-grid {
    max-width: 900px;
}

.feature-list {
    margin: 32px 0;
    display: grid;
    gap: 24px;
}

.feature-list li {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.feature-icon {
    font-size: 1.5rem;
    background: var(--accent-soft);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.highlight-box {
    background: var(--bg-soft);
    border-left: 4px solid var(--brand-blue);
    padding: 24px;
    border-radius: 0 12px 12px 0;
    margin-top: 32px;
    color: var(--text-main);
}

/* THEMES */
.themes-section {
    background: var(--bg-soft);
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.theme-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.theme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
    border-color: var(--brand-light);
}

.theme-badge {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand-blue);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    align-self: flex-start;
}

.theme-title {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.theme-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    flex-grow: 1;
}

.theme-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}

.coming-soon {
    font-size: 0.8rem;
    color: #94A3B8;
    font-style: italic;
}

/* PHILOSOPHY */
.philo-section {
    background: var(--bg-white);
}

.philo-container {
    max-width: 1000px;
}

.philo-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.philo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.philo-item {
    text-align: center;
    padding: 24px;
    background: var(--bg-soft);
    border-radius: var(--radius-md);
    transition: transform 0.3s;
}

.philo-item:hover {
    transform: translateY(-5px);
}

.philo-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.philo-footer {
    margin-top: 48px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* POP/HOW TO */
.how-section {
    background: white;
    border-top: 1px solid var(--border-light);
}

.how-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 32px;
}

.step {
    flex: 1;
    min-width: 250px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-soft);
    padding: 16px;
    border-radius: 12px;
}

.step-num {
    background: var(--brand-blue);
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    flex-shrink: 0;
}

/* CTA */
.cta-section {
    background: var(--brand-blue);
    color: white;
    text-align: center;
}

.cta-box {
    max-width: 800px;
    margin: 0 auto;
}

.cta-title {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.cta-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.25rem;
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* FOOTER */
.site-footer {
    background: var(--brand-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 64px 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 48px;
}

.footer-brand .logo-text {
    color: white;
    font-size: 1.5rem;
    display: block;
    margin-bottom: 12px;
}

.footer-links h4 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 24px;
}

.footer-links ul li {
    margin-bottom: 12px;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    font-size: 0.9rem;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* UTILS - ANIMATIONS */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-100 {
    transition-delay: 0.1s;
}

.delay-200 {
    transition-delay: 0.2s;
}

.delay-300 {
    transition-delay: 0.3s;
}

/* RESPONSIVE */
@media (max-width: 800px) {
    .site-header .main-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 20px;
    }

    .hero-actions {
        align-items: center;
    }

    .hero-visual {
        display: none;
        /* Hide visual on mobile to save space or adjust */
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cta-title {
        font-size: 1.8rem;
    }
}

/* LANGUAGE SWITCHER */
.lang-dropdown {
    position: relative;
    margin-right: 16px;
    font-family: var(--font-body);
}

.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.lang-btn:hover {
    background: var(--bg-soft);
}

.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 150px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}

.lang-dropdown:hover .lang-menu {
    display: flex;
}

.lang-option {
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.lang-option:hover {
    background: var(--bg-soft);
    color: var(--brand-blue);
}

[data-theme="dark"] .lang-menu {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .lang-option {
    color: #e2e8f0;
}

[data-theme="dark"] .lang-option:hover {
    background: #334155;
}

/* RTL SUPPORT (ARABIC) */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .site-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[dir="rtl"] .header-actions button {
    margin-right: 0 !important;
    margin-left: 16px !important;
}

[dir="rtl"] .lang-dropdown {
    margin-right: 0;
    margin-left: 16px;
}

[dir="rtl"] .lang-menu {
    right: auto;
    left: 0;
}

/* Custom RTL Fonts (Cairo) */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

[lang="ar"] {
    font-family: 'Cairo', sans-serif;
}

[lang="ar"] .logo-text {
    font-family: 'Cairo', sans-serif;
    letter-spacing: 0;
}

/* --- DARK MODE FIXES (TOOLS) --- */

/* Quiz */
[data-theme="dark"] .quiz-container {
    background: #1e293b;
    color: #f1f5f9;
}

[data-theme="dark"] .btn-option {
    background: #334155;
    border-color: #475569;
    color: white;
}

[data-theme="dark"] .btn-option:hover {
    background: #475569;
    border-color: var(--brand-blue);
}

/* Calculator */
[data-theme="dark"] .time-card {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .time-input {
    background: #0f172a;
    color: white;
    border-color: #334155;
}

/* Breathing */
[data-theme="dark"] .instruction-step {
    color: #cbd5e1;
}

/* Language Button */
.lang-btn {
    color: var(--text-main);
}

[data-theme="dark"] .lang-btn {
    color: white;
}

/* Fix "How it works" section in dark mode */
[data-theme="dark"] .how-section {
    background: var(--bg-white);
    border-color: var(--border-light);
}