/* 
   DETROIT PRO DETAILING - DESIGN SYSTEM
   Optimizado para iPhone Dynamic Island y Alta Performance
*/

:root {
    --gold: #D4AF37;
    --dark: #0F0F0F;
    --glass: rgba(255, 255, 255, 0.03);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html, body { 
    overflow-x: hidden; 
    width: 100%; 
    max-width: 100vw;
    position: relative; 
    height: 100%;
    background-color: var(--dark);
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
}

body { 
    color: white; 
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    display: flex;
    flex-direction: column;
}

/* Glassmorphism */
.glass { 
    background: var(--glass); 
    backdrop-filter: blur(10px); 
    border: 1px solid rgba(255, 255, 255, 0.05); 
}

.gold-shadow { 
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.3)); 
}

/* Utilities */
.h-scroll-container {
    position: relative;
    width: 100%;
}

.h-scroll {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
    width: 100%;
}

.h-scroll-container::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to left, var(--dark), transparent);
    pointer-events: none;
    z-index: 2;
    border-radius: 0 20px 20px 0;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Header & Navigation */
header.sticky-top-safe {
    position: sticky;
    top: 0; 
    z-index: 100;
    padding: 1rem 1.5rem !important;
    background: rgba(15, 15, 15, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Views Management */
.view { 
    display: none; 
    width: 100%; 
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
}
.view.active { display: block; }
.view::-webkit-scrollbar { width: 0; background: transparent; }

/* Components */
.service-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.service-card:hover {
    transform: translateY(-10px);
    border-color: var(--gold);
}

.service-img-container {
    position: relative;
    height: 200px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.service-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.8s ease;
}

.service-img.next { opacity: 0; }
.service-card:hover .service-img.next { opacity: 1; }

/* Slider Antes/Después */
.comparison-slider { 
    position: relative; width: 100%; height: 450px; overflow: hidden; 
    border-radius: 40px; touch-action: none; user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.image-before { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.image-after { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; clip-path: inset(0 0 0 50%); pointer-events: none; }
.slider-handle { 
    position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; background: var(--gold); 
    cursor: ew-resize; transform: translateX(-50%); z-index: 10;
}
.slider-handle::after {
    content: '↔'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--gold); width: 44px; height: 44px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; color: black; font-weight: bold;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Testimonials Marquee */
.testimonials-track { 
    display: flex; 
    gap: 2rem; 
    animation: marquee 30s linear infinite; 
    width: max-content; 
}
.testimonials-track:hover { 
    animation-play-state: paused; 
}
@keyframes marquee { 
    0% { transform: translateX(0); } 
    100% { transform: translateX(calc(-50% - 1rem)); } 
}
.testimonial-card { 
    width: 350px; 
    flex-shrink: 0; 
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .comparison-slider { height: 350px; }
    .font-display { font-size: 2.25rem !important; }
    .view { padding-bottom: calc(4rem + var(--safe-bottom)); }
    
    header.sticky-top-safe { 
        padding: 0.75rem 1rem !important;
        flex-direction: row;
        flex-wrap: nowrap !important; /* No permitir salto de línea */
        justify-content: space-between;
        gap: 1rem;
    }
    
    #client-header-actions {
        width: auto !important;
        border-top: none !important;
        padding-top: 0 !important;
        flex-shrink: 1;
        overflow-x: auto;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    /* Permitir que el badge se vea */
    .kpi-citas-main {
        grid-column: span 2;
        overflow: visible !important;
    }

    .client-tab {
        padding: 0.6rem 1.25rem !important;
        font-size: 11px !important;
        letter-spacing: 0.05em;
    }

    .kpi-card-compact {
        padding: 1rem !important;
    }

    /* Fix horizontal scroll area in validation */
    .validation-filters {
        display: flex;
        gap: 0.5rem;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
}

.floating-safe-bottom {
    bottom: calc(1.5rem + var(--safe-bottom));
}

/* Animations */
@keyframes pulse-slow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.animate-pulse-slow {
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes ping-custom {
    0% { transform: scale(1); opacity: 1; }
    75%, 100% { transform: scale(1.8); opacity: 0; }
}


/* Enhanced Pending Indicator */
#kpi-pendientes.urgent-ping {
    background: linear-gradient(135deg, #FF4B2B 0%, #FF416C 100%);
    position: relative;
    overflow: visible;
    box-shadow: 0 0 30px rgba(255, 75, 43, 0.5), 
                inset 0 2px 10px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
    animation: urgent-shake 2s ease-in-out infinite;
}

#kpi-pendientes.success-ping {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    position: relative;
    overflow: visible;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3), 
                inset 0 2px 10px rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: none;
}

#kpi-pendientes.urgent-ping::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 3px solid #FF4B2B;
    border-radius: inherit;
    animation: ping-custom 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.6;
}

@keyframes urgent-shake {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03) rotate(0.5deg); }
    25%, 75% { transform: rotate(-0.5deg); }
}

.kpi-title-tiny {
    font-size: 8px;
    letter-spacing: 0.15em;
}

/* Scroll handling */
.h-scroll > * {
    flex-shrink: 0;
}

/* El indicador de scroll se movió a .h-scroll-container::after */

/* Ensure compact KPI layout on mobile */
@media (max-width: 480px) {
    .kpi-card-compact {
        padding: 0.75rem !important;
    }
    .kpi-card-compact h3 {
        font-size: 7px !important;
    }
    .kpi-card-compact p {
        font-size: 1.1rem !important;
    }
}

/* Animaciones de Modales */
@keyframes confirmPop {
    from { opacity:0; transform:scale(0.85) translateY(20px); }
    to   { opacity:1; transform:scale(1) translateY(0); }
}

/* Ajustes de Service Card */
.service-card:hover .service-img.base { opacity: 0; }
.service-card:hover .service-img.next { opacity: 1; }

/* Testimonials Marquee */
.testimonials-track { display: flex; gap: 2rem; animation: marquee 30s linear infinite; width: max-content; }
.testimonials-track:hover { animation-play-state: paused; }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(calc(-50% - 1rem)); } }

