/* 
 * WI STORE PREMIUM STYLES (v2.3.8 - Sticky Layout Fix)
 */

/* 1. Template Grid & Filters */
.wi-grid-container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; }
.wi-filter-bar { display: flex; justify-content: center; gap: 15px; margin-bottom: 50px; flex-wrap: wrap; }
.wi-filter-btn { 
    background: #fff; border: 1px solid #ddd; padding: 10px 25px; border-radius: 30px; 
    cursor: pointer; transition: all 0.3s; font-family: 'Playfair Display', serif; color: #555;
}
.wi-filter-btn.active, .wi-filter-btn:hover { background: #580808; color: #fff; border-color: #580808; box-shadow: 0 4px 15px rgba(88,8,8,0.2); }

/* Filter Dropdown */
.wi-mobile-filters { display: none; }
.wi-filter-select { 
    width: 100%; max-width: 400px; padding: 15px 25px; border-radius: 30px; 
    border: 2px solid #ddd; background: #fff; font-family: 'Playfair Display', serif; 
    font-size: 1.1rem; color: #555; outline: none; margin-bottom: 30px; cursor: pointer;
    appearance: none; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23555%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat; background-position: right 20px top 50%; background-size: 12px auto;
}
.wi-filter-select:focus { border-color: #580808; }

.wi-template-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }

/* Hide mobile-only floating button on desktop */
.wi-mobile-order-btn { display: none; }
.wi-slide { text-align: center; transition: transform 0.3s; }
.wi-slide:hover { transform: translateY(-5px); }

/* Template Grid Device Mockup */
.wi-device-mockup {
    background: #111; border-radius: 40px; border: 12px solid #111;
    position: relative; overflow: hidden; aspect-ratio: 9 / 19.5; height: auto; box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    margin-bottom: 20px; transition: all 0.3s ease; cursor: pointer;
}
.wi-device-mockup::after { 
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); 
    width: 100px; height: 25px; background: #111; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; z-index: 10;
}
.wi-device-mockup:hover { box-shadow: 0 20px 45px rgba(0,0,0,0.15); border-color: #d4af6d; }
.wi-mockup-screen { position: relative; width: 100%; height: 100%; background: #fff; }
.wi-mockup-screen img { width: 100%; height: 100%; object-fit: cover; }
.wi-mockup-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); display: flex; flex-direction: column;
    align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease;
}
.wi-device-mockup:hover .wi-mockup-overlay { opacity: 1; }
.wi-overlay-icon { font-size: 2.5rem; margin-bottom: 10px; }
.wi-overlay-text { color: #fff; font-weight: bold; font-family: 'Playfair Display', serif; }

.wi-tpl-title { font-family: 'Playfair Display', serif; font-size: 1.2rem; color: #333; margin-bottom: 8px; }
.wi-tpl-price { color: #580808; font-weight: bold; font-size: 1.1rem; }

/* Grid Preview Modal */
.wi-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26,26,26,0.95); z-index: 10000; align-items: center; justify-content: center;
    backdrop-filter: blur(10px);
}
.wi-modal.active { display: flex; animation: wiFadeIn 0.3s ease; }
.wi-modal-content {
    background: #fff; border-radius: 20px; width: 90%; max-width: 1000px; height: 80vh;
    display: flex; position: relative; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}
.wi-close-btn {
    position: absolute; top: 15px; right: 15px; background: none; border: none;
    font-size: 30px; cursor: pointer; color: #999; z-index: 10; transition: color 0.3s;
}
.wi-close-btn:hover { color: #333; }
.wi-modal-body { display: flex; width: 100%; height: 100%; flex-direction: row; }
.wi-modal-preview { flex: 1; background: #f9f9f9; display: flex; align-items: center; justify-content: center; padding: 20px; }
.wi-modal-phone { 
    width: auto; max-width: 380px; height: 100%; max-height: 80vh; aspect-ratio: 9 / 19.5; 
    background: #000; border-radius: 40px; border: 12px solid #000; overflow: hidden; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); position: relative; 
}
.wi-modal-phone::after {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); 
    width: 120px; height: 25px; background: #000; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; z-index: 10;
}
.wi-modal-phone iframe { width: 100%; height: 100%; border: none; background: #fff; }

/* Hide scrollbars globally on iframes */
.wi-phone-frame iframe::-webkit-scrollbar,
.wi-modal-phone iframe::-webkit-scrollbar,
.wi-phone-frame::-webkit-scrollbar,
.wi-modal-phone::-webkit-scrollbar {
    display: none !important;
}
.wi-modal-info { flex: 1; padding: 50px; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
.wi-modal-info h2 { font-family: 'Playfair Display', serif; font-size: 2.2rem; color: #1a1a1a; margin-bottom: 10px; }
.wi-modal-price { font-size: 1.8rem; font-weight: bold; color: #d4af6d; margin-bottom: 30px; }
.wi-modal-steps { margin-bottom: 40px; }
.wi-step { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; color: #555; font-size: 1.1rem; }
.wi-step span { background: #f0f0f0; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: bold; color: #333; }
.wi-order-btn {
    background: linear-gradient(135deg, #580808 0%, #7a0c0c 100%); color: #fff; padding: 20px;
    border-radius: 12px; text-align: center; text-decoration: none; font-weight: bold; font-size: 1.2rem;
    transition: transform 0.3s, box-shadow 0.3s; margin-bottom: 30px;
}
.wi-order-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(88,8,8,0.3); color: #fff; }
.wi-modal-nav { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #eee; padding-top: 20px; }
.wi-nav-prev, .wi-nav-next { background: none; border: none; color: #555; font-size: 1.2rem; cursor: pointer; padding: 10px; transition: all 0.3s ease; }
.wi-nav-prev:hover, .wi-nav-next:hover { color: #580808; transform: scale(1.1); }
.wi-nav-counter { font-weight: bold; color: #777; }

/* 2. Customizer Layout (Side-by-Side) */
.wi-live-customizer-wrapper { 
    display: flex; gap: 40px; max-width: 1300px; margin: 40px auto; padding: 0 20px; align-items: flex-start; 
}

.wi-customizer-form-col { flex: 1; min-width: 0; }
.wi-customizer-preview-col { 
    flex: 0 0 400px; position: sticky; top: 100px; display: flex; justify-content: center; 
}

/* Accordion Upgrade */
.wi-customizer-header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }

.wi-accordion-item { 
    background: #ffffff !important; 
    border-radius: 20px !important; 
    margin-bottom: 24px !important; 
    box-shadow: 0 8px 30px rgba(0,0,0,0.04) !important; 
    border: 1px solid #f1f5f9 !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    overflow: hidden !important;
}
.wi-accordion-item:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.08) !important;
}
.wi-accordion-header { display: flex; align-items: center; gap: 18px; padding: 24px 30px; cursor: pointer; transition: background 0.3s; background: #ffffff !important; }
.wi-accordion-item.active .wi-accordion-header { border-bottom: 1px solid #f1f5f9 !important; background: #fcfcfc !important; }
.wi-accordion-header h4 { margin: 0; font-family: 'Playfair Display', serif !important; color: #0f172a !important; font-size: 1.4rem !important; font-weight: 600 !important; letter-spacing: -0.5px !important; flex: 1; }
.wi-card-icon { font-size: 1.5rem !important; background: #fdfbf7 !important; color: #cba052 !important; padding: 12px !important; border-radius: 14px !important; box-shadow: inset 0 2px 4px rgba(203,160,82,0.1) !important; border: 1px solid #f3e8d6 !important; }
.wi-acc-icon { font-size: 0.9rem; color: #94a3b8; transition: transform 0.3s; }
.wi-accordion-item.active .wi-acc-icon { transform: rotate(180deg); }

.wi-accordion-content { display: none; padding: 35px 30px; }
.wi-accordion-item.active .wi-accordion-content { display: block; animation: wiFadeIn 0.4s ease; }

.wi-live-customizer-wrapper .wi-next-step-btn { 
    width: 100% !important; display: block !important; background: #1a1512 !important; color: #cba052 !important; 
    border: none !important; padding: 18px !important; font-size: 1.1rem !important; border-radius: 14px !important; 
    cursor: pointer !important; font-weight: 600 !important; font-family: 'Playfair Display', serif !important;
    transition: all 0.3s !important; margin-top: 20px !important; box-shadow: 0 4px 15px rgba(26,21,18,0.15) !important;
}
.wi-live-customizer-wrapper .wi-next-step-btn:hover { background: #2a221d !important; transform: translateY(-2px) !important; box-shadow: 0 8px 25px rgba(26,21,18,0.25) !important; }

.wi-form-group { margin-bottom: 26px !important; }
.wi-live-customizer-wrapper .wi-form-group label { 
    display: block !important; margin-bottom: 8px !important; font-weight: 700 !important; font-size: 0.75rem !important; 
    color: #64748b !important; text-transform: uppercase !important; letter-spacing: 1px !important; font-family: 'Montserrat', sans-serif !important;
}
.wi-live-customizer-wrapper .wi-form-group input, 
.wi-live-customizer-wrapper .wi-form-group textarea { 
    width: 100% !important; padding: 16px 20px !important; border: 1px solid #e2e8f0 !important; border-radius: 12px !important; 
    background: #f8fafc !important; transition: all 0.2s ease !important; font-size: 1rem !important; color: #1e293b !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important; font-family: 'Montserrat', sans-serif !important;
}
.wi-live-customizer-wrapper .wi-form-group input:focus, 
.wi-live-customizer-wrapper .wi-form-group textarea:focus { 
    border-color: #cba052 !important; background: #ffffff !important; box-shadow: 0 0 0 4px rgba(203,160,82,0.1) !important; outline: none !important; transform: translateY(-1px) !important;
}
.wi-live-customizer-wrapper .wi-form-group input::placeholder, 
.wi-live-customizer-wrapper .wi-form-group textarea::placeholder { color: #94a3b8 !important; font-weight: 400 !important; }

/* Premium File Input Style */
.wi-live-customizer-wrapper .wi-form-group input[type="file"] {
    padding: 10px !important; background: #ffffff !important; border: 2px dashed #cbd5e1 !important; color: #64748b !important; cursor: pointer !important;
}
.wi-live-customizer-wrapper .wi-form-group input[type="file"]::file-selector-button {
    background: #1e293b !important; color: #ffffff !important; border: none !important; padding: 10px 18px !important; border-radius: 8px !important; 
    cursor: pointer !important; font-weight: 600 !important; font-size: 0.9rem !important; margin-right: 15px !important; transition: background 0.2s !important;
}
.wi-live-customizer-wrapper .wi-form-group input[type="file"]::file-selector-button:hover { background: #334155 !important; }

.wi-flex-row { display: flex; gap: 20px; }
.wi-flex-row .wi-form-group { flex: 1; }

/* Phone Frame - Premium Upgrade */
.wi-phone-frame { 
    width: 340px; height: 690px; background: #000; border-radius: 50px; border: 14px solid #000; 
    position: relative; box-shadow: 0 40px 80px rgba(0,0,0,0.25), inset 0 0 20px rgba(255,255,255,0.1); overflow: hidden;
}
.wi-phone-frame::after { 
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); 
    width: 140px; height: 30px; background: #000; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; z-index: 10;
}
.wi-phone-frame::before {
    content: ''; position: absolute; top: 15px; right: 25px; width: 6px; height: 6px; border-radius: 50%; background: #333; z-index: 11;
}
.wi-phone-frame iframe { width: 100%; height: 100%; border: none; background: #fff; }

/* Buttons - Premium Upgrade */
.wi-approve-btn { 
    background: linear-gradient(135deg, #580808 0%, #7a0c0c 100%); color: #ffffff !important; width: 100%; padding: 22px; border-radius: 16px; 
    border: none; font-size: 1.15rem; font-weight: bold; cursor: pointer; transition: all 0.3s ease; letter-spacing: 0.5px;
    box-shadow: 0 10px 20px rgba(88,8,8,0.2);
}
.wi-approve-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(88,8,8,0.4); }

/* Mobile Preview Toggle (Hidden on Desktop) */
.wi-mobile-preview-toggle { display: none !important; }
.wi-close-preview-toggle { display: none !important; }

/* RESPONSIVE & MOBILE-FIRST OPTIMIZATIONS */
@media (max-width: 991px) {
    .wi-desktop-filters { display: none !important; }
    .wi-mobile-filters { display: flex; justify-content: center; width: 100%; padding: 0; }
    .wi-filter-select { padding: 10px 15px; font-size: 1rem; width: 90%; max-width: 300px; margin-bottom: 10px; }

    /* 2-column grid on mobile — no horizontal scroll */
    .wi-grid-container { padding: 20px 16px; }
    .wi-template-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        overflow: visible;
    }

    .wi-slide { flex: none; scroll-snap-align: unset; }
    .wi-slide:hover { transform: none; }

    /* Fix mockup sizing on mobile */
    .wi-device-mockup { max-width: 100%; border-width: 8px; border-radius: 25px; margin-bottom: 10px; }
    .wi-device-mockup::after { width: 70px; height: 15px; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }

    .wi-tpl-title { font-size: 0.9rem; }
    .wi-tpl-price { font-size: 0.9rem; }

    .wi-live-customizer-wrapper { flex-direction: column; padding: 0 10px; margin: 20px auto; }
    
    /* Optimize cards for smaller screens */
    .wi-form-card { padding: 20px; border-radius: 16px; margin-bottom: 20px; }
    .wi-card-header h4 { font-size: 1.2rem; }
    .wi-flex-row { flex-direction: column; gap: 0; }
    
    /* Ensure inputs don't cause iOS zoom (must be 16px minimum) */
    .wi-form-group input, .wi-form-group textarea { font-size: 16px; padding: 12px 15px; }
    
    /* Mobile Preview Overlay */
    .wi-customizer-preview-col { 
        display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; 
        background: #000; z-index: 9999; flex: none; align-items: center; justify-content: center; padding: 0 !important; 
    }
    .wi-customizer-preview-col.active { display: flex; animation: wiFadeIn 0.3s ease; }
    
    /* Remove phone frame entirely on mobile - make it full screen */
    .wi-phone-frame { 
        width: 100% !important; max-width: none !important; height: 100vh !important; max-height: none !important; 
        border: none !important; border-radius: 0 !important; box-shadow: none !important; 
    }
    .wi-phone-frame::after, .wi-phone-frame::before { display: none !important; }
    
    /* Floating Action Button for Live Preview */
    .wi-mobile-preview-toggle { 
        display: flex !important; align-items: center; justify-content: center; gap: 8px;
        position: fixed; top: 15px; right: 15px; z-index: 9998;
        background: #1a1a1a; color: #d4af6d; padding: 10px 15px; border-radius: 20px; 
        cursor: pointer; box-shadow: 0 5px 15px rgba(0,0,0,0.2); font-weight: bold; font-size: 0.9rem;
        border: 1px solid #333; transition: transform 0.2s;
    }
    .wi-mobile-preview-toggle:active { transform: scale(0.95); }
    .wi-mobile-preview-toggle::before { content: '👁️'; font-size: 1.2rem; }
    
    /* Close Button for Overlay - Maroon, Rounded, Text */
    .wi-close-preview-toggle { 
        display: flex !important; align-items: center; justify-content: center; gap: 4px;
        position: fixed; top: 20px; right: 20px; font-family: 'Montserrat', sans-serif !important;
        color: #fff !important; background: #580808 !important; /* Maroon */
        padding: 10px 20px !important; border-radius: 30px !important; 
        cursor: pointer; z-index: 10001; border: none !important; font-size: 1rem !important; 
        font-weight: 600 !important; box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important;
        width: auto !important; height: auto !important; line-height: 1 !important;
    }
    .wi-close-preview-toggle::before { content: "Close"; font-size: 0.9rem; font-weight: bold; }

    /* Grid Modal Mobile Overrides - Remove Mockup */
    .wi-modal { padding: 0 !important; }
    .wi-modal-content { height: 100vh; max-height: none; width: 100%; border-radius: 0; flex-direction: column; overflow: hidden; background: #000; position: relative; }
    .wi-modal-body { flex-direction: column; height: 100%; overflow: hidden; }
    
    .wi-modal-preview { flex: 1; padding: 0; background: #000; display: flex; justify-content: center; align-items: center; height: 100%; }
    .wi-modal-phone { 
        width: 100% !important; max-width: none !important; height: 100% !important; max-height: none !important; 
        border: none !important; border-radius: 0 !important; box-shadow: none !important; 
    }
    .wi-modal-phone::after { display: none !important; }
    
    .wi-modal-info { display: none !important; /* Hide pricing/info on mobile grid preview so it acts purely as a full-screen preview */ }
    
    /* Move grid close button to match maroon style */
    .wi-close-btn {
        display: flex !important; align-items: center; justify-content: center; gap: 4px;
        position: fixed !important; top: 20px !important; right: 20px !important;
        color: #fff !important; background: #580808 !important; 
        padding: 10px 20px !important; border-radius: 30px !important; 
        font-size: 1.2rem !important; font-family: 'Montserrat', sans-serif !important;
        font-weight: 600 !important; z-index: 10001 !important; border: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important; width: auto !important; height: auto !important;
    }
    .wi-close-btn::before { content: "Close"; font-size: 0.9rem; font-weight: bold; margin-top: 2px; }
    
    /* Mobile Customize Button inside Grid Preview */
    .wi-mobile-order-btn {
        display: flex !important; align-items: center; justify-content: center;
        position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%);
        background: linear-gradient(135deg, #d4af6d 0%, #b08942 100%);
        color: #1a1512 !important; padding: 18px 30px; border-radius: 30px;
        font-weight: bold; font-size: 1.15rem; font-family: 'Montserrat', sans-serif;
        box-shadow: 0 10px 25px rgba(212,175,109,0.5); z-index: 10000;
        text-decoration: none !important; width: 85%;
        border: 1px solid rgba(255,255,255,0.2);
    }
}

@media (max-width: 480px) {
    .wi-modal-info h2 { font-size: 1.3rem; }
    .wi-modal-price { font-size: 1.2rem; }
    .wi-modal-steps { display: none; } /* Hide steps to save vertical space */
    .wi-order-btn { padding: 15px; font-size: 1.1rem; margin-bottom: 5px; }
    
    /* Modal Navigation Absolute Positioning */
    .wi-modal-nav { border-top: none; padding-top: 0; margin: 0; }
    .wi-nav-counter { position: absolute; top: 15px; left: 15px; font-size: 1.1rem; font-weight: bold; color: #777; z-index: 100; }
    .wi-nav-prev, .wi-nav-next { 
        position: absolute; top: 30%; transform: translateY(-50%); 
        width: 40px; height: 40px; background: #fff; border-radius: 50%;
        display: flex; justify-content: center; align-items: center;
        box-shadow: 0 4px 15px rgba(0,0,0,0.15); z-index: 100; font-size: 1.2rem; color: #333;
    }
    .wi-nav-prev { left: 10px; }
    .wi-nav-next { right: 10px; }
    
    .wi-close-btn { 
        display: flex !important; align-items: center; justify-content: center; gap: 6px;
        position: fixed !important; top: 20px !important; right: 20px !important;
        color: #fff !important; background: #580808 !important; 
        padding: 10px 20px !important; border-radius: 30px !important; 
        font-size: 0.95rem !important; font-family: 'Montserrat', sans-serif !important;
        font-weight: 600 !important; z-index: 10001 !important; border: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important; width: auto !important; height: auto !important;
    }
}

@keyframes wiFadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
