/* Liquid Glass UI System (iOS 26 Inspired) */

:root {
    /* Light Mode Palette */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-highlight: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.1);
    --glass-blur: blur(20px);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    
    --accent-primary: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.4);
    
    --surface-gradient: radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.15) 0px, transparent 50%),
                        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
}

.dark {
    /* Dark Mode Palette */
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.5);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --surface-gradient: radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.1) 0px, transparent 50%),
                        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.05) 0px, transparent 50%);
}

/* Global Reset & Base */
body {
    background-color: #f0f4f8;
    background-image: var(--surface-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.dark body {
    background-color: #020617;
}

/* --- Liquid Glass Components --- */

/* 1. Glass Containers (Cards, Nav, Modals) */
.glass-nav, .glass-card, .booking-card, #mobile-menu, 
.bg-white, .bg-gray-50, .bg-gray-100 {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
    position: relative;
}

/* Navbar Specifics */
.glass-nav {
    border-radius: 0 0 24px 24px;
    border-top: none;
    z-index: 50;
    background: rgba(255, 255, 255, 0.75) !important; /* Slightly more opaque */
}
.dark .glass-nav {
    background: rgba(15, 23, 42, 0.75) !important;
}

/* Card Interactions */
.glass-card, .booking-card {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, border-color 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-primary);
}

/* Remove legacy styles */
.booking-card::before { display: none; }

/* 2. Inputs (Recessed Glass) */
input, select, textarea, .custom-input {
    background: rgba(255, 255, 255, 0.3) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 18px !important;
    padding: 12px 16px;
    backdrop-filter: blur(10px);
    color: var(--text-primary) !important;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.dark input, .dark select, .dark textarea, .dark .custom-input {
    background: rgba(0, 0, 0, 0.3) !important;
}

input:focus, select:focus, textarea:focus {
    background: rgba(255, 255, 255, 0.6) !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 4px var(--accent-glow), inset 0 1px 2px rgba(0,0,0,0.02);
    outline: none;
}

.dark input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* 3. Buttons (Liquid & Glowing) */
button, .btn {
    border-radius: 9999px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    position: relative;
    overflow: hidden;
}

/* Primary Action Buttons */
.bg-tech-600, .bg-green-600, .bg-red-600, .bg-tech-500 {
    background-image: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0));
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 20px var(--accent-glow);
}

button:hover {
    transform: scale(1.04);
    filter: brightness(1.1);
    box-shadow: 0 8px 25px var(--accent-glow);
}

button:active {
    transform: scale(0.98);
}

/* 4. Modals (Floating Sheets) */
#cart-modal > div, #quick-view-modal > div, #compare-modal > div, #loan-modal > div {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.4);
}

/* 5. Typography & Icons */
.text-gray-900, .text-gray-800 { color: var(--text-primary) !important; }
.text-gray-600, .text-gray-500, .text-gray-700 { color: var(--text-secondary) !important; }

/* Liquid Glass Icon */
.liquid-glass-icon {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    border-radius: 24px;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Utilities & Animations --- */

/* WhatsApp Float */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(37, 211, 102, 0.85);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    text-align: center;
    font-size: 30px;
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
}

.whatsapp-float:hover {
    transform: scale(1.1) rotate(10deg);
    background: #25d366;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 16px 20px;
    border-radius: 20px;
    box-shadow: 0 15px 40px -10px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: var(--text-primary);
    transform: translateX(120%);
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.hide { animation: slideOut 0.4s forwards; }

@keyframes slideIn { to { transform: translateX(0); } }
@keyframes slideOut { to { transform: translateX(120%); opacity: 0; } }

/* Float Animation */
.float { animation: float 6s ease-in-out infinite; }
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

/* Product Entry Animation */
.product-enter {
    animation: elasticPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}
@keyframes elasticPop {
    0% { opacity: 0; transform: scale(0.8) translateY(40px); filter: blur(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

/* Shimmer Effect */
.shimmer-btn { position: relative; overflow: hidden; }
.shimmer-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    animation: shimmer 3s infinite;
}
@keyframes shimmer { 100% { left: 200%; } }

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    #invoice-area, #invoice-area * { visibility: visible; }
    #invoice-area { 
        position: absolute; left: 0; top: 0; width: 100%; 
        background: white !important; color: black !important;
        box-shadow: none; border: none;
    }
    .no-print { display: none !important; }
}

/* --- Fixes & Additions --- */

/* Ensure Modals sit above the Glass Navbar (z-50) */
#cart-modal, #quick-view-modal, #compare-modal, #loan-modal {
    z-index: 60 !important;
}

/* Before/After Slider Styles (Moved from booking.html) */
.ba-slider { position: relative; overflow: hidden; cursor: col-resize; }
.ba-slider img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-before { position: absolute; top: 0; left: 0; height: 100%; width: 50%; overflow: hidden; border-right: 3px solid #fff; box-shadow: 5px 0 15px rgba(0,0,0,0.3); will-change: width; }
.ba-before img { max-width: none; }
.ba-handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; background: #fff; border-radius: 50%; z-index: 10; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 10px rgba(0,0,0,0.3); pointer-events: none; transition: transform 0.2s; }
.ba-input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: col-resize; z-index: 20; margin: 0; touch-action: none; }
.ba-slider:hover .ba-handle { transform: translate(-50%, -50%) scale(1.1); }

/* Futuristic Quick View Animation */
@keyframes futuristicExit {
    0% { opacity: 1; transform: scale(1); filter: blur(0) brightness(1); }
    100% { opacity: 0; transform: scale(0.9); filter: blur(10px) brightness(2); }
}

@keyframes futuristicEnter {
    0% { opacity: 0; transform: scale(1.1); filter: blur(10px) brightness(2); }
    100% { opacity: 1; transform: scale(1); filter: blur(0) brightness(1); }
}

.qv-exit {
    animation: futuristicExit 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.qv-enter {
    animation: futuristicEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- New CRO Additions --- */

/* Sticky Mobile Bottom Nav */
.mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 0 0 20px 20px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Stock Progress Bar */
.stock-progress-bg {
    background: rgba(0,0,0,0.1);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
}
.dark .stock-progress-bg { background: rgba(255,255,255,0.1); }
.stock-progress-fill {
    height: 100%;
    background: #ef4444;
    border-radius: 99px;
    transition: width 1s ease;
}

/* Exit Popup Animation */
.scale-in { animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- Visual Polish (Liquid Glass Extras) --- */

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(14, 165, 233, 0.3); border-radius: 4px; backdrop-filter: blur(4px); }
::-webkit-scrollbar-thumb:hover { background: rgba(14, 165, 233, 0.6); }

/* Text Selection */
::selection { background: rgba(14, 165, 233, 0.3); color: #0c4a6e; }

/* Mobile Menu Animation */
#mobile-menu {
    transform-origin: top;
    animation: menuSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes menuSlide {
    from { opacity: 0; transform: scaleY(0.9) translateY(-10px); }
    to { opacity: 1; transform: scaleY(1) translateY(0); }
}
