/* 
   TherapieMarocOnline - Design System 
   Optimized for Performance (No-Framework)
*/

:root {
    /* --- Palette de Couleurs --- */
    --color-bg: #F9F7F2;
    /* Crème/Papier - Fond principal */
    --color-text: #2D4A3E;
    /* Vert Forêt - Texte principal */
    --color-primary: #2D4A3E;
    /* Vert Forêt - Actions primaires */
    --color-secondary: #E07A5F;
    /* Terracotta - Actions secondaires/Accents */
    --color-white: #ffffff;
    --color-surface: #ffffff;
    /* Cartes */

    /* --- Typographie --- */
    --font-serif: 'Playfair Display', serif;
    /* Titres */
    --font-sans: 'DM Sans', sans-serif;
    /* Corps */

    /* --- Espacements --- */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 8rem;

    /* --- Styles --- */
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --container-width: 1200px;
}

/* --- Reset Minimal --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* --- Layout --- */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
}

header,
section,
footer {
    width: 100%;
}

/* --- Components --- */

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-serif);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
    font-size: 1.5rem;
}

.text-center {
    text-align: center;
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--color-secondary);
    color: var(--color-white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    opacity: 0.9;
}

.btn-outline {
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    background-color: rgba(249, 247, 242, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 0.5rem 0;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 50px;
    /* Reduced from 60px for better fit */
}

@media (max-width: 768px) {
    .logo img {
        height: 40px;
    }
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

/* Burger Menu - Modern UX */
.burger-menu {
    display: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
    z-index: 1100;
    background: transparent;
    border: none;
    transition: transform 0.3s ease;
}

.burger-menu:hover {
    transform: scale(1.1);
}

.burger-menu:active {
    transform: scale(0.95);
}

.burger-menu div {
    width: 28px;
    height: 3px;
    background-color: var(--color-primary);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

/* Mobile Menu Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* --- Mobile/Tablet Responsive Styles --- */
@media (max-width: 1024px) {

    /* Navbar Mobile Layout */
    .navbar-content {
        padding: 0.75rem 1rem;
    }

    /* Burger Menu Positioning */
    .burger-menu {
        display: flex;
        position: absolute;
        right: 1.5rem;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1200 !important;
        /* Always on top */
    }

    .logo img {
        height: 40px;
        /* Optimal mobile size */
    }

    /* FULL SCREEN HEADER MENU */
    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 100%;
        background-color: var(--color-bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        /* Animation: Fade + Slide Up feel */
        transform: translateY(-20px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 1100;
        padding-bottom: 2rem;
        /* Account for bottom bar */
    }

    /* Active State */
    .nav-active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: all;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s ease 0.1s;
    }

    /* Stagger Animation for items when active */
    .nav-active li {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-active li:nth-child(1) {
        transition-delay: 0.1s;
    }

    .nav-active li:nth-child(2) {
        transition-delay: 0.15s;
    }

    .nav-active li:nth-child(3) {
        transition-delay: 0.2s;
    }

    .nav-active li:nth-child(4) {
        transition-delay: 0.25s;
    }

    .nav-active li:nth-child(5) {
        transition-delay: 0.3s;
    }

    .nav-active li:nth-child(6) {
        transition-delay: 0.35s;
    }

    .nav-active li:nth-child(7) {
        transition-delay: 0.4s;
    }

    .nav-links a {
        display: inline-block;
        font-family: var(--font-serif);
        font-size: 1.75rem;
        /* Larger font for accessibility */
        color: var(--color-text);
        font-weight: 600;
        text-decoration: none;
    }

    .nav-links a:hover {
        color: var(--color-secondary);
        transform: scale(1.05);
    }

    /* Mobile Only Visibility Utilities */
    .mobile-only-item {
        display: block !important;
        margin-top: 0.5rem;
    }

    .desktop-only {
        display: none !important;
    }

    /* Burger Animation */
    .toggle .line1 {
        transform: translateY(9px) rotate(45deg);
        background-color: var(--color-secondary);
    }

    .toggle .line2 {
        opacity: 0;
        transform: translateX(-20px);
    }

    .toggle .line3 {
        transform: translateY(-9px) rotate(-45deg);
        background-color: var(--color-secondary);
    }
}

@media (max-width: 768px) {

    /* Fix Sticky Bar Overlap */
    body {
        padding-bottom: 90px;
    }

    /* Refined Typography for Mobile */
    h1 {
        font-size: 2rem !important;
        /* Smaller header for better fit */
        line-height: 1.25;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    /* Spacing Adjustment */
    .container {
        padding-left: 1.5rem;
        /* More breathing room */
        padding-right: 1.5rem;
    }

    /* Stats Card Mobile Layout - Fix Overlap */
    .stats-card {
        padding: 1.5rem !important;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem !important;
        /* Move it down, no negative margin */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
    }

    .stat-item {
        border: none !important;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid #eee !important;
        margin-bottom: 0 !important;
    }

    .stat-item:last-child {
        border-bottom: none !important;
        padding-bottom: 0;
    }

    /* Hero Height */
    .hero {
        min-height: auto;
        padding: 6rem 1.5rem 3rem 1.5rem;
        /* Top padding for header, bottom for content */
        text-align: center;
        /* Ensure center alignment */
    }

    .hero-content {
        padding: 0;
        width: 100%;
    }

    .hero-bg {
        object-position: center 25%;
    }

    /* Better Button Sizes */
    .btn {
        min-height: 52px;
        width: 100%;
        /* Full width buttons on mobile */
        margin-bottom: 0.5rem;
    }

    /* Navigation link size mobile */
    .nav-links a {
        font-size: 1.5rem;
    }

    /* Active Feedback */
    .card:active {
        transform: scale(0.98);
        background-color: #fcfcfc;
    }
}

/* Mobile Language Switcher Styles */
.mobile-lang-switcher {
    display: none;
}

@media (max-width: 1024px) {
    .mobile-lang-switcher {
        display: flex;
        align-items: center;
        margin-right: 1rem;
        margin-left: auto;
        z-index: 1001;
    }

    .burger-menu {
        margin-left: 0;
        position: relative;
        right: auto;
        top: auto;
        transform: none;
    }

    .navbar-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}

/* Default state for mobile items on Desktop */
.mobile-only-item {
    display: none;
}

.hero {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    background-color: var(--color-primary);
    /* Fallback */
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0.4;
    /* Overlay effect handled by CSS opacity on image wrapper or pseudo-element */
}

/* To simulate the gradient overlay */
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(45, 74, 62, 0.9), rgba(45, 74, 62, 0.7));
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 800px;
    text-align: center;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Cards (Features, Services) */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card {
    background-color: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

/* Footer */
.footer {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--spacing-lg) 0 var(--spacing-md);
}

.footer a:hover {
    text-decoration: underline;
}

/* WhatsApp Gradient Button */
.btn-gradient-whatsapp {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.btn-gradient-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
    opacity: 0.95;
}

/* Title Gradient Background (Badge Style) */
.gradient-title-bg {
    background: linear-gradient(135deg, #151a15 0%, #2D4A3E 100%);
    color: white !important;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    display: inline-block;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --- New Additions (Step 2) --- */

/* Video Embed Responsive Wrapper */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Soft border */
    background: #000;
}

.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mobile Sticky Bar */
.sticky-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    display: none;
    padding: 1rem;
    z-index: 2000;
    justify-content: space-between;
    gap: 0.5rem;
}

.sticky-bottom-bar .btn-sticky-primary {
    flex: 0 0 70%;
    background-color: var(--color-primary);
    color: white;
    border-radius: var(--radius);
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sticky-bottom-bar .btn-sticky-secondary {
    flex: 0 0 28%;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius);
    color: var(--color-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    text-decoration: none;
}

@media (max-width: 768px) {
    .sticky-bottom-bar {
        display: flex;
    }

    /* Hide floating button on mobile */
    .whatsapp-float {
        display: none !important;
    }
}