/* Modern Hacienda Design System & Desktop Shell */
:root {
    --primary: #ac2d00;
    --primary-container: #d53e0b;
    --secondary: #7e5700;
    --secondary-container: #feb300;
    --background: #f4faff;
    --surface: #f4faff;
    --surface-container-lowest: #ffffff;
    --surface-container-low: #e7f6ff;
    --surface-container: #dff1fb;
    --surface-container-high: #d9ebf5;
    --surface-container-highest: #d4e5ef;
    --on-background: #0d1e25;
    --on-surface-variant: #5b4139;
    
    /* Desktop Shell Variables */
    --phone-width: 430px;
    --phone-height: 880px;
    --phone-radius: 60px;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

.custom-icon-active {
    font-family: inherit !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.custom-icon-active svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--background);
    color: var(--on-background);
    font-family: 'Work Sans', sans-serif;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    display: none;
}

/* Material Symbols Adjustments */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    display: inline-block;
}

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

/* ============================================
   MOBILE-FIRST BASE STYLES (all screens)
   ============================================ */

#desktop-wrapper {
    display: block;
    width: 100%;
    min-height: 100vh;
    background-color: var(--background);
}

#iphone-frame {
    position: relative;
    width: 100%;
    height: 100vh;
    background: var(--background);
    overflow: hidden;
    z-index: 20;
}

#dynamic-island {
    display: none;
}

#app-viewport {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
    background: var(--background);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#app-viewport::-webkit-scrollbar {
    display: none;
}

/* SPA Animations */
.page-transition {
    animation: fadeInSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.page-exit {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
    transition: all 0.4s ease;
}

@keyframes fadeInSlideUp {
    0% {
        opacity: 0;
        filter: blur(10px);
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

/* ============================================
   DESKTOP: iPhone 17 Pro Mockup Experience
   ============================================ */

@media (min-width: 1024px) {

    /* --- Background & Wrapper --- */
    #desktop-wrapper {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        background-image: url('assets/desktop_bg_pro.png');
        background-size: cover;
        background-position: center;
        background-attachment: fixed;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        z-index: 0;
    }

    /* Glassmorphism overlay with spotlight hole */
    #desktop-wrapper::before {
        content: '';
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(13, 30, 37, 0.4);
        backdrop-filter: blur(40px) saturate(150%);
        -webkit-backdrop-filter: blur(40px) saturate(150%);
        z-index: 1;
        pointer-events: none;
        -webkit-mask-image: radial-gradient(circle 250px at var(--mouse-x, 50%) var(--mouse-y, 50%), transparent 0%, black 100%);
        mask-image: radial-gradient(circle 250px at var(--mouse-x, 50%) var(--mouse-y, 50%), transparent 0%, black 100%);
    }

    #desktop-wrapper.is-over-app::before {
        -webkit-mask-image: none;
        mask-image: none;
        backdrop-filter: blur(60px);
        background: rgba(0, 0, 0, 0.6);
    }

    /* --- iPhone 17 Pro Frame --- */
    #iphone-frame {
        position: relative;
        width: 430px;
        min-width: 430px;
        max-width: 430px;
        height: calc(100vh - 80px);
        max-height: var(--phone-height);
        background: black;
        border-radius: var(--phone-radius);
        border: 12px solid #1a1a1a;
        box-shadow:
            0 0 0 4px #333,
            0 30px 100px -20px rgba(0,0,0,0.8),
            0 0 150px rgba(172, 45, 0, 0.1);
        z-index: 10;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        transition: transform 0.4s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.4s ease;
        /* Creates a new stacking context so fixed children stay inside */
        transform: translateZ(0);
        will-change: transform;
        contain: layout style paint;
    }

    #desktop-wrapper.is-over-app #iphone-frame {
        transform: scale(1.02);
        box-shadow:
            0 0 0 4px #333,
            0 40px 120px -20px rgba(0,0,0,0.9),
            0 0 150px rgba(172, 45, 0, 0.2);
    }

    /* --- Dynamic Island --- */
    #dynamic-island {
        display: block;
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 120px;
        height: 35px;
        background: black;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
        z-index: 1000;
    }

    /* --- App Viewport: scrollable content area --- */
    #app-viewport {
        flex: 1 1 0%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        position: relative;
        background: var(--background);
    }

    /* --- Footer: pinned at bottom of frame, never scrolls --- */
    #footer-shell {
        flex-shrink: 0;
        position: relative;
        z-index: 100;
        width: 100%;
    }

    /* Convert the nav from fixed to relative inside the frame */
    #footer-shell nav {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
    }

    /* Fixed elements inside the viewport become absolute */
    #iphone-frame #app-viewport .fixed {
        position: absolute !important;
        transform: none !important;
    }

    /* Sticky elements stay sticky inside scroll container */
    #iphone-frame #app-viewport .sticky {
        position: sticky !important;
    }

    /* Floating cart stays above the footer */
    #iphone-frame #floating-cart.fixed,
    .floating-cart-system {
        position: absolute !important;
        bottom: 10px !important;
        width: calc(100% - 32px) !important;
        left: 16px !important;
        right: 16px !important;
        margin: 0 !important;
        transform: none !important;
    }
}

/* 3D Decor Elements - Disabled */
.decor-3d {
    display: none !important;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* Floating Cart Design */
.glass-btn {
    background: linear-gradient(135deg, #ac2d00 0%, #7e2100 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 20px 40px -10px rgba(172, 45, 0, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.glass-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.glass-btn:hover::after {
    left: 100%;
}

.floating-cart-system {
    width: calc(100% - 32px);
    left: 16px;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#floating-cart:not(.hidden) {
    animation: slideUpIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideUpIn {
    0% { transform: translateY(100px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Pulsate Animation for Status Chips */
@keyframes pulsate-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.animate-pulsate-red {
    animation: pulsate-red 2s infinite;
}

@keyframes pulsate-green {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.animate-pulsate-green {
    animation: pulsate-green 2s infinite;
}

/* Premium Cart Button Style - Larger and Iconic */
.premium-cart-btn {
    background-color: #000 !important;
    color: #fff !important;
    width: 56px !important;
    height: 56px !important;
    padding: 0 !important; /* Managed by width/height for square icon buttons */
    border: none !important;
    box-shadow: 0 0 15px #ff00ff88, 0 0 5px #ff00ff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.25rem !important;
    overflow: visible;
    flex-shrink: 0;
}

.premium-cart-btn:active, .premium-cart-btn.added-success {
    background-color: #16a34a !important; /* Current green color */
    box-shadow: 0 0 15px #16a34a88, 0 0 4px #16a34a !important;
    transform: scale(0.95);
}
