/**
 * Déboucheur Expert - Main Stylesheet
 * Custom CSS extending Tailwind CSS
 * @version 2.0.0
 * @author Déboucheur Expert Team
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
    /* Colors */
    --color-dark-base: #000000;
    --color-dark-alt: #131313;
    --color-light-base: #FFFFFF;
    --color-light-alt: #F2F2F2;
    --color-cardinal: #C41E3A;
    --color-green: #22c55e;
    --color-blue: #2563EB;
    --color-blue-dark: #1d4ed8;
    
    /* Spacing */
    --radius-base: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
    --transition-carousel: 700ms ease-in-out;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow-blue: 0 0 40px rgba(37, 99, 235, 0.4);
    --shadow-glow-green: 0 0 40px rgba(34, 197, 94, 0.4);
    
    /* Z-index layers */
    --z-base: 1;
    --z-sticky: 10;
    --z-navbar: 50;
    --z-urgency: 60;
    --z-chat-btn: 70;
    --z-chat: 80;
    --z-modal: 90;
    --z-progress: 1000;
}

/* ============================================
   BASE STYLES & RESETS
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    overflow-x: hidden;
}

/* Scrollbar hiding for clean UI */
.scrollbar-hide::-webkit-scrollbar,
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide,
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Thin scrollbar variant */
.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.box-radius {
    border-radius: var(--radius-base);
}

.box-radius-lg {
    border-radius: var(--radius-lg);
}

.transition-base {
    transition: all var(--transition-base);
}

/* Text outline utilities */
.text-outline-black {
    text-shadow: 
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000;
}

.text-outline-white {
    text-shadow: 
        1px 1px 0 #fff,
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff;
}

/* Theme-adaptive text outlines */
/* Dark theme = black outline (readable on dark bg with light text) */
/* Light theme = white outline (readable on light bg with dark text) */
.theme-text-outline {
    text-shadow: 
        1px 1px 0 rgba(0, 0, 0, 0.3),
        -1px -1px 0 rgba(0, 0, 0, 0.3);
}

.dark .theme-text-outline {
    text-shadow: 
        1px 1px 0 rgba(255, 255, 255, 0.3),
        -1px -1px 0 rgba(255, 255, 255, 0.3);
}

.dark-mode-outline {
    text-shadow: 
        1px 1px 0 rgba(0, 0, 0, 0.25),
        -1px -1px 0 rgba(0, 0, 0, 0.25);
}

.light-mode-outline {
    text-shadow: 
        1px 1px 0 rgba(255, 255, 255, 0.25),
        -1px -1px 0 rgba(255, 255, 255, 0.25);
}

/* ============================================
   NAVIGATION STYLES
   ============================================ */
.nav-glass {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-link {
    position: relative;
    transition: all var(--transition-base);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--color-blue);
    transition: all var(--transition-base);
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

/* Navigation dots */
.nav-dot {
    width: 12px;
    height: 12px;
    margin: 8px 0;
    border-radius: var(--radius-full);
    background-color: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all var(--transition-base);
}

.nav-dot:hover {
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.nav-dot.active {
    background-color: var(--color-blue);
    border-color: var(--color-blue);
    transform: scale(1.3);
    box-shadow: 0 0 10px var(--color-blue);
}

/* Dot Navigation Buttons (right side of screen) */
.dot-btn {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    background-color: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dark .dot-btn {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.dot-btn:hover {
    background-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.3);
}

.dot-btn.active {
    background-color: var(--color-blue);
    border-color: var(--color-blue);
    transform: scale(1.4);
    box-shadow: 0 0 12px var(--color-blue);
}

/* ============================================
   MOBILE MENU ANIMATION
   ============================================ */
.mobile-menu-closed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.mobile-menu-open {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-nav-link {
    opacity: 0;
    transform: translateX(20px);
}

/* ============================================
   DROPDOWN MENU
   ============================================ */
.dropdown-closed {
    max-height: 0;
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
    pointer-events: none;
    transition: all var(--transition-base);
}

.dropdown-open {
    max-height: 500px;
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
    transition: all var(--transition-slow);
}

.dropdown-content {
    transform-origin: top;
    animation: dropdown-unroll 0.3s ease-out;
}

@keyframes dropdown-unroll {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   HERO & SLIDESHOW
   ============================================ */
.sticky-section {
    position: sticky;
    top: 0;
    min-height: 100vh;
    width: 100%;
}

.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    will-change: opacity, transform;
    transform: scale(1.15);
    overflow: hidden;
}

.hero-slide.active {
    opacity: 1;
    animation: heroZoomOut 6s linear forwards;
}

.hero-slide.was-active {
    transform: scale(1);
    animation: none;
}

/* Hero zoom keyframes defined in panda.css */

/* ============================================
   SERVICE CARDS
   ============================================ */
.service-card {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0.4) 100%
    );
    transition: opacity var(--transition-base);
}

.dark .service-card::before {
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

.service-card > * {
    position: relative;
    z-index: 1;
}

.service-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

/* ============================================
   ACCORDION
   ============================================ */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: 
        max-height var(--transition-slow),
        opacity var(--transition-base);
}

.accordion-content.open {
    max-height: 500px;
    opacity: 1;
}

.rotate-icon {
    transition: transform var(--transition-base);
}

.rotate-icon.active {
    transform: rotate(180deg);
}

/* ============================================
   TESTIMONIALS CAROUSEL
   ============================================ */
.testimonial-card {
    opacity: 0.6;
    transform: scale(0.9);
    transition: all var(--transition-carousel);
    will-change: transform, opacity;
}

.testimonial-card.active-card {
    opacity: 1;
    transform: scale(1);
}

.testimonial-img-shadow {
    box-shadow: 
        0 4px 15px rgba(37, 99, 235, 0.3),
        0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ============================================
   CONTACT FORM
   ============================================ */
.input-focus {
    border-color: var(--color-blue) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.input-valid {
    border-color: var(--color-green) !important;
}

.input-error {
    border-color: var(--color-cardinal) !important;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Contact slider for mobile */
.contact-slider {
    transition: transform var(--transition-slow);
}

/* ============================================
   AI CHAT WIDGET
   ============================================ */
.hidden-widget {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all var(--transition-base);
}

#ai-chat-widget:not(.hidden-widget) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-msg {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
    max-width: 85%;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: message-in 0.3s ease;
}

.user-msg {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    border-bottom-right-radius: 4px;
    max-width: 85%;
    margin-left: auto;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: message-in 0.3s ease;
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing indicator */
.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-full);
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   MAP SECTION
   ============================================ */
.map-glow-light {
    box-shadow: 
        inset 0 0 60px rgba(37, 99, 235, 0.15),
        0 0 30px rgba(37, 99, 235, 0.1);
}

.map-glow-dark {
    box-shadow: 
        inset 0 0 60px rgba(37, 99, 235, 0.25),
        0 0 40px rgba(37, 99, 235, 0.2);
}

.map-overlay-panel {
    position: absolute;
    top: 5px;
    left: 5px;
    bottom: 5px;
    width: clamp(200px, 22vw, 320px);
    background: var(--color-light-base);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    z-index: 20;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.dark .map-overlay-panel {
    background: var(--color-dark-alt);
}

/* Hide Google Maps default overlays */
.gm-style .place-card,
.gm-style .place-card-large,
.gm-style .gm-inset-map,
.gm-style .gm-bundled-control {
    display: none !important;
}

/* ============================================
   LESSONS SECTION
   ============================================ */
.lesson-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: 10;
}

/* ============================================
   CALENDAR GRID
   ============================================ */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-base);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.calendar-day:hover:not(.calendar-day-disabled) {
    background-color: rgba(37, 99, 235, 0.1);
    transform: scale(1.05);
}

.calendar-day-today {
    background-color: var(--color-blue);
    color: white;
    font-weight: 700;
}

.calendar-day-selected {
    background-color: var(--color-green);
    color: white;
}

.calendar-day-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calendar-day-booked {
    background-color: var(--color-cardinal);
    color: white;
    cursor: not-allowed;
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero-slide {
        transition: opacity 0.1s ease;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .nav-glass,
    #ai-chat-widget,
    #urgency-btn,
    #scroll-top-btn,
    .nav-dot,
    #cookie-banner {
        display: none !important;
    }
    
    .sticky-section {
        position: relative;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* ============================================
   DARK MODE SPECIFIC OVERRIDES
   ============================================ */
.dark body {
    color-scheme: dark;
}

.dark ::selection {
    background: var(--color-blue);
    color: white;
}

.dark input::placeholder,
.dark textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 768px) {
    .nav-dot {
        width: 10px;
        height: 10px;
        margin: 6px 0;
    }
    
    .map-overlay-panel {
        width: calc(100% - 10px);
        left: 5px;
        right: 5px;
        top: 5px;
        bottom: auto;
        height: auto;
        max-height: 35vh;
    }
    
    /* Ensure sections fit in viewport */
    .sticky-section {
        min-height: 100vh;
        max-height: 100vh;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    :root {
        --radius-base: 6px;
        --radius-lg: 12px;
    }
    
    .map-overlay-panel {
        max-height: 30vh;
    }
}

/* Landscape mobile orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .map-overlay-panel {
        width: clamp(180px, 20vw, 250px);
        height: calc(100% - 10px);
        max-height: none;
    }
}
