/* ============================================
   RESPONSIVE FIXES
   ============================================ */

/* Global Container Fixes */
@media (max-width: 1400px) {
    .container {
        max-width: 1140px;
    }
}

@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 720px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 540px;
        padding: 0 15px;
    }
}

@media (max-width: 576px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
}

/* Header & Navigation Fixes */
@media (max-width: 992px) {
    .header-container {
        padding: 0 15px;
    }
    
    .main-nav {
        display: none; /* Force hide desktop nav */
    }
    
    .mobile-menu-toggle {
        display: flex; /* Ensure toggle is visible */
    }
    
    .logo-text {
        font-size: 20px;
    }
}

/* Mobile Menu Improvements */
.mobile-menu {
    width: 300px; /* consistent width */
    overflow-y: auto;
}

.mobile-nav-link {
    font-size: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.mobile-submenu {
    background: #f9f9f9;
}

/* Announcement Bar */
@media (max-width: 768px) {
    .announcement-item {
        font-size: 11px;
        padding: 0 20px;
    }
}

/* Hero Section Fixes */
@media (max-width: 992px) {
    .modern-hero {
        height: auto;
        padding-bottom: 60px;
    }

    .hero-split-layout {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
        padding-top: 40px;
    }

    .hero-content {
        padding: 0;
        margin: 0 auto;
        max-width: 100%;
    }

    .hero-title {
        font-size: 36px;
        margin-bottom: 15px;
    }

    .hero-description {
        font-size: 16px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 25px;
    }

    .hero-cta {
        justify-content: center;
        margin-bottom: 40px;
    }

    .hero-visual-col {
        height: 300px;
        margin-top: 0;
    }

    .hero-visual-wrapper {
        width: 300px;
        height: 300px;
        margin: 0 auto;
    }

    .hero-image {
        transform: rotate(0);
        max-width: 100%;
        width: auto;
        height: 100%;
    }
    
    .swiper-slide-active .hero-image {
        animation: none; /* Disable complex animations on mobile for performance */
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 28px;
    }
    
    .btn-hero, .btn-hero-secondary {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .hero-visual-col {
        height: 250px;
    }
    
    .hero-visual-wrapper {
        width: 250px;
        height: 250px;
    }
}

/* Categories Grid Fixes */
@media (max-width: 1200px) {
    .categories-glass-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .categories-glass-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 576px) {
    .categories-glass-grid {
        grid-template-columns: 1fr; /* Stack vertically on small phones */
    }
    
    .glass-cat-card {
        height: 200px; /* Slightly shorter on mobile */
    }
}

/* Product Grid Fixes */
@media (max-width: 1200px) {
    .products-grid, .products-grid.modern-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .products-grid, .products-grid.modern-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Featured Collection Slider Fixes */
@media (max-width: 768px) {
    .products-slider {
        padding: 0;
    }
    
    /* Hide default swiper arrows on mobile, maybe use dots or swipe only */
    .products-slider .swiper-button-prev,
    .products-slider .swiper-button-next {
        display: none;
    }

    /* Footer Accordion */
    .footer-accordion-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        margin-bottom: 0;
        padding: 15px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .footer-accordion-header i {
        transition: transform 0.3s ease;
        font-size: 14px;
    }

    .footer-accordion-header.active i {
        transform: rotate(180deg);
        color: var(--primary-color);
    }

    .footer-accordion-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .footer-links {
        padding-top: 15px;
    }

    .footer-contact {
        padding-top: 15px;
    }
}

/* Custom Design Section Fixes */
@media (max-width: 992px) {
    .custom-design-section {
        padding: 60px 0;
    }
    
    .custom-design-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .custom-design-content p {
        margin-left: auto;
        margin-right: auto;
    }
    
    .custom-actions {
        justify-content: center;
    }
    
    .custom-title {
        font-size: 36px;
    }
}

@media (max-width: 576px) {
    .custom-title {
        font-size: 28px;
    }
    
    .custom-actions {
        flex-direction: column;
    }
    
    .btn-lg {
        width: 100%;
    }
}

/* Features Minimal Fixes */
@media (max-width: 992px) {
    .features-minimal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 576px) {
    .features-minimal-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .feature-minimal {
        text-align: center;
    }
    
    .icon-minimal {
        margin: 0 auto 15px;
    }
}

/* Footer Fixes */
@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .footer-column:first-child {
        grid-column: span 2;
        text-align: center;
    }
    
    .footer-logo, .footer-about {
        margin-left: auto;
        margin-right: auto;
        max-width: 400px;
    }
    
    .footer-social {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-column:first-child {
        grid-column: span 1;
    }
    
    .footer-contact li {
        justify-content: center;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .footer-legal {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
}


/* ============================================
   SHOP PAGE FIXES
   ============================================ */
@media (max-width: 992px) {
    .shop-layout {
        grid-template-columns: 1fr;
    }

    .shop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        max-width: 85vw; /* Safe width */
        height: 100vh;
        z-index: 2000; /* Higher than header */
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        padding-top: 60px; /* Space for close button if needed */
    }

    .shop-sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay for sidebar */
    .shop-sidebar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: -1;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        width: 100vw; /* Stretch to cover screen */
        height: 100vh;
        transform: translateX(100%); /* Hide when sidebar is closed */
    }

    .shop-sidebar.active::before {
        opacity: 1;
        visibility: visible;
        transform: translateX(0); /* Bring into view with sidebar parent (careful here) */
        /* Actually pseudo-element on sidebar moves WITH sidebar. 
           Better to use a separate overlay div or just rely on body click. 
           Let's use a cleaner approach in JS if possible, or just shadow. 
        */
    }
    
    .sidebar-close {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
    }

    .filter-toggle {
        display: flex;
    }
    
    .shop-toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .toolbar-left, .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .toolbar-right {
        border-top: 1px solid #eee;
        padding-top: 15px;
    }
}


/* ============================================
   CART & CHECKOUT FIXES
   ============================================ */
@media (max-width: 992px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }
    
    .checkout-layout {
        grid-template-columns: 1fr;
    }
    
    .checkout-summary {
        position: relative; /* Unstick on mobile */
        top: 0;
        margin-top: 30px;
    }
}

@media (max-width: 576px) {
    .cart-item-row {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 15px;
        background: #fff;
        border: 1px solid #eee;
        border-radius: 8px;
        margin-bottom: 15px;
    }
    
    .cart-product {
        flex-direction: column;
    }
    
    .cart-product-image {
        width: 100px;
        height: 100px;
        margin: 0 auto;
    }
    
    .cart-quantity {
        margin: 0 auto;
        justify-content: center;
    }
    
    .cart-qty-btn {
        width: 44px; /* Larger touch target */
        height: 44px;
    }
    
    .cart-qty-input {
        height: 44px;
    }
    
    .cart-total {
        font-size: 18px;
        margin-top: 10px;
    }
    
    .cart-remove {
        position: absolute;
        top: 10px;
        right: 10px;
        background: #f8f9fa;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Make cart item relative for absolute positioning of remove btn */
    .cart-item-row {
        position: relative;
    }
    
    /* Checkout Form Mobile */
    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
    
    .payment-option-content {
        padding: 15px;
    }
}


/* ============================================
   CUSTOM DESIGNER FIXES
   ============================================ */
@media (max-width: 992px) {
    .custom-design-interface {
        padding: 10px; /* Reduce padding to save space */
    }
    
    .app-container {
        flex-direction: column;
        height: auto !important; /* Let content dictate height or fix it */
        border: none;
        background: transparent;
    }
    
    /* Workspace Area */
    .canvas-workspace {
        height: 50vh; /* Use half screen height */
        min-height: 300px;
        max-height: 500px;
        width: 100%;
        border-radius: 12px;
        margin-bottom: 15px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    
    /* Controls Panel */
    .controls-panel {
        width: 100%;
        border-left: none;
        border-top: none; /* Removed border */
        background: transparent;
        padding: 0;
        overflow: visible;
    }
    
    #dynamic-controls {
        background: #fff;
        padding: 20px;
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    }
    
    /* Control Groups */
    .control-group {
        margin-bottom: 15px;
    }
    
    /* D-Pad Size Increase */
    .d-pad-grid {
        gap: 10px;
        grid-template-columns: repeat(3, 50px);
        grid-template-rows: repeat(3, 50px);
    }
    
    .btn-move {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    /* Action Buttons */
    .btn-secondary {
        padding: 12px; /* Taller touch target */
    }
    
    /* Step Selectors */
    .form-group label {
        font-size: 1rem; /* Slightly smaller headers */
    }
    
    .form-control-lg {
        height: 45px;
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .canvas-workspace {
        height: 40vh; /* Smaller on phones */
        min-height: 250px;
    }
    
    .d-pad-grid {
        gap: 5px;
        grid-template-columns: repeat(3, 45px);
        grid-template-rows: repeat(3, 45px);
    }
    
    .btn-move {
        width: 45px;
        height: 45px;
    }
}

