/**
 * Mobile Responsive Fixes - Natural Paints & Coatings
 * Covers ALL pages: index, products, contact, gallery,
 * color-palette, order, painting-guide, about, admin
 * Mobile-first approach, tested from 320px to 1024px
 */

/* ============================================
   GLOBAL BASE FIXES
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

img, iframe, video {
    max-width: 100%;
}

/* Prevent YouTube iframe from overflowing */
.hero-video-container {
    overflow: hidden !important;
}

/* ============================================
   NAVBAR — FIXED + MOBILE MENU
   ============================================ */

/* Sticky on ALL screen sizes (important for pages that use absolute positioning) */
@media (max-width: 1024px) {
    .navbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.96) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        box-shadow: 0 2px 20px rgba(0,0,0,0.08) !important;
        z-index: 1030 !important;
        padding: 0.65rem 0 !important;
    }

    body { padding-top: 70px; }

    .navbar-container {
        padding: 0 1.25rem !important;
    }

    .navbar-logo img { height: 36px !important; }

    .navbar-logo > div span:first-child {
        font-size: 1.8rem !important;
    }
}

@media (max-width: 768px) {
    body { padding-top: 62px; }

    .navbar { padding: 0.5rem 0 !important; }

    .navbar-container { padding: 0 1rem !important; }

    .navbar-logo img { height: 30px !important; }

    .navbar-logo > div span:first-child {
        font-size: 1.4rem !important;
    }

    .navbar-logo > div span:last-child {
        font-size: 0.6rem !important;
        letter-spacing: 1px;
    }

    /* Show hamburger */
    .navbar-toggle {
        display: flex !important;
        z-index: 1100 !important;
        margin-left: auto;
    }

    /* Full-screen overlay menu */
    .navbar-menu {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(255,255,255,0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        gap: 1.25rem !important;
        padding: 2rem !important;
        z-index: 1050 !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        left: 50% !important;
        transform: translateX(-50%) translateY(-100%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        margin: 0 !important;
    }

    .navbar-menu.active {
        transform: translateX(-50%) translateY(0) !important;
        opacity: 1 !important;
        pointer-events: all !important;
    }

    .navbar-link {
        font-size: 1.4rem !important;
        font-weight: 600 !important;
        padding: 0.5rem 1.5rem !important;
        width: 100%;
        text-align: center;
        min-height: 44px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .navbar-cta {
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
    }

    .navbar-cta .btn {
        min-width: 180px !important;
        padding: 0.75rem 2rem !important;
        font-size: 1rem !important;
    }
}

/* ============================================
   CONTAINER
   ============================================ */
@media (max-width: 768px) {
    .container { padding: 0 1rem !important; }
}

@media (max-width: 480px) {
    .container { padding: 0 0.875rem !important; }
}

@media (max-width: 360px) {
    .container { padding: 0 0.75rem !important; }
}

/* ============================================
   SECTION SPACING
   ============================================ */
@media (max-width: 768px) {
    .section     { padding: var(--space-xl) 0 !important; }
    .section-sm  { padding: var(--space-lg) 0 !important; }
    .section-lg  { padding: var(--space-2xl) 0 !important; }
    .section-header { margin-bottom: var(--space-xl) !important; }
    .section-title  { font-size: clamp(1.5rem, 5.5vw, 2.5rem) !important; }
    .section-description { font-size: 0.95rem !important; }
}

/* ============================================
   GLOBAL GRID UTILITIES
   ============================================ */
@media (max-width: 1024px) {
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr) !important; }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 { grid-template-columns: 1fr !important; }
    .gap-xl { gap: var(--space-md) !important; }
    .gap-lg { gap: var(--space-sm) !important; }
}

/* ============================================
   BUTTONS
   ============================================ */
@media (max-width: 768px) {
    .btn { min-height: 44px; }
    .btn-lg {
        padding: 0.875rem 1.75rem !important;
        font-size: 1rem !important;
    }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
@media (max-width: 768px) {
    h1 { font-size: clamp(1.8rem, 7vw, 3rem) !important; }
    h2 { font-size: clamp(1.5rem, 5.5vw, 2.5rem) !important; }
    h3 { font-size: clamp(1.2rem, 4.5vw, 2rem) !important; }
}

/* ============================================
   ① INDEX.HTML — HERO + SLIDESHOW + FEATURES
   ============================================ */

/* Hero modern section */
.hero-modern {
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hero-modern {
        padding: 5rem 0 2rem !important;
        min-height: auto !important;
    }

    /* Slideshow card */
    .hero-modern-card {
        grid-template-columns: 1fr !important;
        padding: 1.5rem !important;
        gap: 1.5rem !important;
        min-height: auto !important;
    }

    /* Hide decorative side widgets on mobile */
    .hero-widget-left,
    .hero-widget-right {
        display: none !important;
    }

    /* Slide images */
    .hero-card-slideshow {
        height: 260px !important;
        border-radius: 16px !important;
    }

    .hero-card-slide {
        border-radius: 16px !important;
    }

    /* Hero card overlay text */
    .hero-card-overlay {
        padding: 1.25rem !important;
    }

    .hero-card-overlay h1,
    .hero-card-overlay .hero-title {
        font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
    }

    /* Feature showcase section */
    .feature-showcase-section { padding: var(--space-xl) 0 !important; }

    .feature-showcase-container {
        grid-template-columns: 1fr !important;
        text-align: center !important;
        gap: 2rem !important;
    }

    /* Comparison grid */
    .comparison-grid,
    .comparison-grid-redesign {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .comparison-card {
        width: 100% !important;
        padding: 1.5rem !important;
    }

    .vs-badge {
        width: 50px !important;
        height: 50px !important;
        margin: -1.25rem auto !important;
    }
}

@media (max-width: 480px) {
    .hero-card-slideshow { height: 200px !important; }
    .hero-modern { padding: 4.5rem 0 1.5rem !important; }
}

/* ============================================
   ② PRODUCTS.HTML — LAYOUT, FILTER, GRID
   ============================================ */

@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 1fr !important;
    }

    .products-sidebar {
        position: static !important;
        top: auto !important;
        margin-bottom: 1.5rem !important;
        padding: 1.25rem !important;
        border-radius: 20px !important;
    }

    /* Make filter groups horizontal scroll */
    .filter-group {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
}

@media (max-width: 768px) {
    .products-layout { gap: 1rem !important; }

    /* Product grid responsive */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .product-card-image { height: 180px !important; }

    .product-card-body { padding: 1rem !important; }

    .product-card-title { font-size: 1rem !important; }

    /* Filter options as pill scrollers */
    .filter-option {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.85rem !important;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .product-card-image { height: 200px !important; }
}

/* ============================================
   ③ CONTACT.HTML — HERO, FORM, INFO CARDS
   ============================================ */

@media (max-width: 992px) {
    .contact-content {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .contact-form-card { order: -1; }
}

@media (max-width: 768px) {
    .contact-hero-modern {
        padding: 5rem 0 2rem !important;
        min-height: 50vh !important;
    }

    .contact-form-card {
        padding: var(--space-lg) !important;
        border-radius: 20px !important;
    }

    .contact-info-card {
        padding: var(--space-sm) !important;
        border-radius: 14px !important;
    }

    .contact-info-card:hover { transform: none !important; }

    /* Social links grid */
    .social-links-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* white-space: nowrap on h2 causes overflow on small screens */
    .contact-form-card h2 {
        white-space: normal !important;
        font-size: clamp(1.3rem, 5vw, 2rem) !important;
    }
}

@media (max-width: 480px) {
    .contact-hero-modern {
        padding: 4.5rem 0 1.5rem !important;
        min-height: 45vh !important;
    }

    .social-links-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   ④ GALLERY.HTML — GRID + LIGHTBOX
   ============================================ */

@media (max-width: 768px) {
    .gallery-section {
        padding-top: 120px !important;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 0 0.75rem !important;
    }

    .gallery-title {
        font-size: clamp(1.8rem, 7vw, 3rem) !important;
    }

    /* Gallery item images */
    .gallery-image-container {
        border-radius: 12px !important;
    }

    /* Navigation arrows */
    .card-nav-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .gallery-section { padding-top: 100px !important; }
}

/* ============================================
   ⑤ COLOR-PALETTE.HTML — FILTER BAR + GRID
   ============================================ */

@media (max-width: 992px) {
    .secondary-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    .palette-hero {
        padding: 5rem 0 2rem !important;
        min-height: 45vh !important;
    }

    /* Filter bar becomes scrollable */
    .filter-bar {
        position: sticky !important;
        top: 62px !important; /* below fixed navbar */
        z-index: 100 !important;
        border-radius: 0 !important;
        margin: 0 -1rem 1.5rem !important;
        padding: 0.75rem 1rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .primary-filters {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .filter-btn {
        padding: 0.4rem 0.875rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .advanced-filters {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    /* Color grid — 3 per row on mobile */
    .color-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.75rem !important;
    }

    .color-dot {
        width: 50px !important;
        height: 50px !important;
    }

    /* Color modal responsive */
    .modal-body {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .modal-content {
        margin: 1rem !important;
        padding: 1.5rem !important;
        border-radius: 20px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 480px) {
    .color-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.5rem !important;
    }

    .color-dot {
        width: 40px !important;
        height: 40px !important;
    }
}

/* ============================================
   ⑥ ORDER.HTML — FORM LAYOUT
   ============================================ */

@media (max-width: 768px) {
    .order-card {
        padding: 1.75rem 1.25rem !important;
        border-radius: 20px !important;
        margin: 0.5rem !important;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .form-section {
        padding: 1.25rem !important;
        border-radius: 16px !important;
    }

    /* Fix form inputs - prevent iOS zoom */
    .form-input,
    .form-select,
    .form-textarea,
    input, select, textarea {
        font-size: 16px !important;
        padding: 0.75rem 0.875rem !important;
    }
}

@media (max-width: 480px) {
    .order-card {
        padding: 1.25rem 1rem !important;
        margin: 0.25rem !important;
        border-radius: 16px !important;
    }
}

/* ============================================
   ⑦ PAINTING-GUIDE.HTML — HERO, CARDS, TABLE
   ============================================ */

@media (max-width: 768px) {
    .guide-hero-modern {
        padding: 5rem 0 2rem !important;
        min-height: 55vh !important;
    }

    .guide-hero-card {
        padding: 1.75rem 1.25rem !important;
        border-radius: 20px !important;
    }

    .modern-guide-card {
        padding: var(--space-md) !important;
        border-radius: 20px !important;
    }

    .modern-guide-card:hover { transform: none !important; }

    /* Guide step list */
    .step-list-modern {
        padding-left: 0 !important;
    }

    /* Comparison table — horizontally scrollable */
    .comparison-table-modern {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
        border-radius: 12px !important;
    }

    .comparison-table-modern th,
    .comparison-table-modern td {
        padding: 0.75rem 0.875rem !important;
        font-size: 0.85rem !important;
        min-width: 120px;
    }

    /* Two-col grids in painting guide */
    .grid.grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   ⑧ ABOUT.HTML — HERO, STATS, CARDS
   ============================================ */

@media (max-width: 768px) {
    .about-hero-modern {
        min-height: 60vh !important;
        padding: 5rem 0 2.5rem !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin-top: 1.5rem !important;
    }

    .stat-number { font-size: 2rem !important; }
    .stat-label  { font-size: 0.85rem !important; }

    .glass-panel {
        padding: 1.5rem !important;
        border-radius: 20px !important;
    }

    .glass-section-panel,
    div[class*="glass-section"] {
        padding: 2rem 1.25rem !important;
        border-radius: 24px !important;
    }

    /* Environmental stats row */
    .glass-section-panel .grid.grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
        text-align: center;
    }

    .premium-card {
        padding: 1.5rem !important;
        border-radius: 18px !important;
    }

    .premium-card:hover { transform: none !important; }

    .icon-box {
        width: 56px !important;
        height: 56px !important;
        font-size: 1.6rem !important;
        border-radius: 14px !important;
    }

    .value-card {
        padding: 1.5rem !important;
        border-radius: 20px !important;
    }

    .value-card:hover  { transform: none !important; }

    .value-icon {
        width: 70px !important;
        height: 70px !important;
        font-size: 2rem !important;
    }

    .feature-item {
        padding: 1rem !important;
        gap: 1rem !important;
    }

    .feature-item:hover { transform: none !important; }

    .modern-feature-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .modern-feature-card {
        padding: 1.5rem !important;
        border-radius: 20px !important;
    }

    .modern-feature-card:hover { transform: none !important; }
}

@media (max-width: 480px) {
    .about-hero-modern {
        min-height: 55vh !important;
        padding: 4.5rem 0 2rem !important;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }

    .stat-card { padding: 0.75rem 0.4rem !important; }
    .stat-number { font-size: 1.3rem !important; }
    .stat-label  { font-size: 0.65rem !important; }

    .modern-feature-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Values grid (used in about + possibly other pages) */
.values-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 1024px) {
    .values-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
    .values-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
}

/* ============================================
   ⑨ ADMIN PAGES — SIDEBAR + TABLES + CARDS
   ============================================ */

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column !important;
    }

    .admin-sidebar {
        width: 100% !important;
        height: auto !important;
        position: static !important;
        border-radius: 0 !important;
        padding: 0.5rem !important;
        overflow-x: auto !important;
    }

    .admin-nav {
        flex-direction: row !important;
        gap: 0.25rem !important;
        padding: 0 !important;
        white-space: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .admin-nav a,
    .admin-nav-item {
        padding: 0.5rem 0.875rem !important;
        font-size: 0.8rem !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
    }

    .admin-content { padding: 1rem !important; }

    /* Stat cards */
    .admin-stats-grid,
    .stats-grid-admin {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Tables scrollable */
    .admin-table-wrapper,
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        display: block !important;
        width: 100% !important;
        border-radius: 12px !important;
    }

    table {
        min-width: 500px;
    }

    table th,
    table td {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    .admin-stats-grid { grid-template-columns: 1fr !important; }
}

/* ============================================
   FOOTER — ALL PAGES
   ============================================ */

@media (max-width: 992px) {
    .footer-floating-island {
        padding: 2.5rem 2rem !important;
    }

    .footer-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem !important;
    }
}

@media (max-width: 768px) {
    .footer-modern { padding-top: 1.5rem !important; }

    .footer-floating-island {
        padding: 2rem 1.25rem 1.5rem !important;
        border-radius: 24px 24px 0 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .footer-grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1.75rem !important;
    }

    /* Footer bottom bar stacks */
    .footer-floating-island > div:last-child > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .footer-modern h3[style] { font-size: 1.5rem !important; }
}

@media (max-width: 480px) {
    .footer-floating-island {
        padding: 1.5rem 1rem 1rem !important;
        border-radius: 18px 18px 0 0 !important;
    }

    .footer-grid-4 { gap: 1.25rem !important; }
}

/* ============================================
   SCROLL PROGRESS BAR
   ============================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary, linear-gradient(135deg, #B91C1C, #EF4444));
    z-index: 9999;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ============================================
   SCROLL TO TOP BUTTON
   ============================================ */

.scroll-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #B91C1C, #EF4444);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 990;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(220,38,38,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s, box-shadow 0.3s;
}

.scroll-to-top.visible {
    opacity: 1;
    pointer-events: all;
}

.scroll-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(220,38,38,0.45);
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ============================================
   FEATURE CARD (hero cards used on most pages)
   ============================================ */

@media (max-width: 768px) {
    .feature-card {
        padding: var(--space-md) !important;
        margin: 0 0.25rem !important;
    }

    .feature-card-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.8rem !important;
    }

    .feature-card-title {
        font-size: clamp(1.4rem, 5.5vw, 2.2rem) !important;
    }
}

/* ============================================
   CTA BUTTON ROWS
   ============================================ */

@media (max-width: 600px) {
    /* Any inline flex CTA row */
    .btn + .btn,
    .hero-cta,
    div[style*="display: flex"][style*="justify-content: center"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
    }

    .btn-lg {
        width: 100% !important;
        max-width: 300px !important;
    }
}

/* ============================================
   FORMS — ALL PAGES
   ============================================ */

@media (max-width: 768px) {
    input, select, textarea,
    .form-input, .form-select, .form-textarea {
        font-size: 16px !important; /* prevent iOS auto-zoom */
        padding: 0.75rem 0.875rem !important;
    }
}

/* ============================================
   MODAL — COLOR PALETTE + PRODUCT DETAIL
   ============================================ */

@media (max-width: 768px) {
    .modal-content {
        margin: 0.75rem !important;
        padding: 1.5rem !important;
        border-radius: 20px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    .modal-close {
        top: 0.75rem !important;
        right: 0.75rem !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (max-width: 768px) {
    /* Min 44px touch targets */
    a, button, .btn,
    .navbar-link,
    .navbar-toggle,
    .filter-btn,
    .filter-option,
    .scroll-to-top {
        min-height: 44px;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */

@media (max-width: 896px) and (orientation: landscape) {
    .about-hero-modern,
    .contact-hero-modern,
    .guide-hero-modern,
    .palette-hero,
    .hero-modern {
        min-height: 100vh !important;
        padding-top: 4rem !important;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .navbar-menu {
        overflow-y: auto !important;
        padding: 0.75rem 2rem !important;
        gap: 0.75rem !important;
    }

    .navbar-link { font-size: 1.1rem !important; }
}

/* ============================================
   320px MINIMUM SCREEN
   ============================================ */

@media (max-width: 360px) {
    .container { padding: 0 0.75rem !important; }

    .btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
    }

    .glass-section-panel,
    .glass-panel,
    .premium-card,
    .modern-feature-card,
    .order-card {
        padding: 1rem 0.875rem !important;
    }

    .footer-floating-island {
        padding: 1.25rem 0.875rem 1rem !important;
    }

    .navbar-logo > div span:first-child {
        font-size: 1.2rem !important;
    }
}

/* ============================================
   PATCH v2 — ALL REPORTED ISSUES
   ============================================ */

/* ── 1. NAVBAR: Hide Shop-Now button on mobile so it never overlaps ── */
@media (max-width: 768px) {
    /* hide the "Shop Now" CTA from the bar — it appears inside the overlay menu */
    .navbar-cta { display: none !important; }

    /* Make sure hamburger always visible and properly placed */
    .navbar-toggle {
        display: flex !important;
        order: 3;
        margin-left: auto;
        z-index: 1100 !important;
    }

    /* Compact the container so logo + hamburger fit without squeeze */
    .navbar-container {
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
    }
}

/* On tablet (769–1024px) shrink the button instead of hiding */
@media (min-width: 769px) and (max-width: 1024px) {
    .navbar-cta { display: flex !important; align-items: center; }

    .navbar-cta .btn,
    .navbar-cta a.btn {
        padding: 0.4rem 1rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap !important;
        min-height: 34px !important;
        border-radius: 50px !important;
    }

    /* Logo text compact */
    .navbar-logo > div span:first-child { font-size: 1.5rem !important; }
    .navbar-logo > div span:last-child  { font-size: 0.6rem !important; }
    .navbar-logo img { height: 32px !important; }
}

/* ── 2. HERO SLIDESHOW: Force a real height so images show fully ── */
/* Root issue: .hero-modern-card has no height → .hero-card-slideshow
   (position:absolute) collapses to 0 on mobile */
@media (max-width: 1024px) {
    .hero-modern {
        padding-top: 4rem !important;
        padding-bottom: 1.5rem !important;
    }

    /* Give the card an explicit height — images need a container */
    .hero-modern-card {
        aspect-ratio: unset !important;
        min-height: unset !important;
        height: clamp(220px, 60vw, 520px) !important;
        width: 95% !important;
        padding: 0 !important;           /* no padding so slides fill card */
        border-radius: 20px !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .hero-card-slideshow {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 20px !important;
    }

    .hero-card-slide {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background-size: cover !important;
        background-position: center !important;
    }
}

@media (max-width: 480px) {
    .hero-modern-card {
        height: clamp(200px, 65vw, 300px) !important;
        border-radius: 14px !important;
        width: 100% !important;
    }
}

/* ── 3. CONTRACTOR vs TECHNOLOGIST: Stack cards vertically ── */
@media (max-width: 768px) {
    /* The redesign grid — make it a simple column stack */
    .comparison-grid-redesign {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        position: relative !important;
    }

    /* Reduce big padding on each panel card */
    .comparison-grid-redesign > div {
        padding: 1.5rem 1.25rem !important;
        border-radius: 20px !important;
    }

    /* Shrink 130px icon circle */
    .comparison-grid-redesign div[style*="width: 130px"],
    .comparison-grid-redesign div[style*="width:130px"] {
        width: 80px !important;
        height: 80px !important;
        margin-bottom: 1.25rem !important;
    }

    /* Shrink 4rem emoji inside icon */
    .comparison-grid-redesign div[style*="font-size: 4rem"] {
        font-size: 2.2rem !important;
        width: 80px !important;
        height: 80px !important;
    }

    /* Contractor/Technologist heading text */
    .contractor-title,
    .technologist-title {
        font-size: 1.25rem !important;
        letter-spacing: 0 !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    /* Description box inside each card */
    .comparison-grid-redesign div[style*="border-radius: 25px"] {
        padding: 1rem 0.875rem !important;
        border-radius: 14px !important;
        margin-bottom: 1rem !important;
    }

    .comparison-grid-redesign div[style*="border-radius: 25px"] p {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }

    /* Feature list rows inside cards */
    .comparison-grid-redesign div[style*="border-radius: 18px"] {
        padding: 0.75rem !important;
        gap: 0.75rem !important;
    }

    /* 50px icon box inside features */
    .comparison-grid-redesign div[style*="width: 50px"][style*="height: 50px"] {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 1.1rem !important;
        border-radius: 9px !important;
    }

    /* VS badge */
    .vs-badge {
        width: 48px !important;
        height: 48px !important;
        font-size: 0.9rem !important;
        margin: -0.75rem auto !important;
        z-index: 2;
        position: relative;
    }

    /* Section header h2 with 3rem font */
    .glass-section-panel h2[style*="3rem"],
    .glass-section-panel h2[style*="font-size: 3rem"] {
        font-size: clamp(1.3rem, 5vw, 2rem) !important;
        letter-spacing: -0.5px !important;
    }

    /* Outer glass-section-panel padding */
    .glass-section-panel[style*="padding: 5rem"],
    .glass-section-panel[style*="5rem 4rem"] {
        padding: 1.5rem 1rem !important;
        border-radius: 20px !important;
    }
}

/* ── 4. WHO WE SERVE (Schools/Architects/Builders/Engineers)
   Inline style repeat(2,1fr) needs !important override ── */
@media (max-width: 640px) {
    /* Target the inline 2-col grid around the 4 serve-cards */
    div[style*="grid-template-columns: repeat(2, 1fr)"][style*="gap: 2rem"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Each serve card padding */
    div[style*="border-radius: 24px"][style*="padding: 2.5rem"] {
        padding: 1.25rem !important;
        border-radius: 16px !important;
    }

    /* 64px icon box in serve cards */
    div[style*="width: 64px"][style*="height: 64px"] {
        width: 46px !important;
        height: 46px !important;
        font-size: 1.4rem !important;
        margin-bottom: 0.875rem !important;
        border-radius: 12px !important;
    }

    /* Serve card title */
    div[style*="border-radius: 24px"] h3[style*="font-size: 1.5rem"] {
        font-size: 1.1rem !important;
        margin-bottom: 0.4rem !important;
    }

    /* Serve card description */
    div[style*="border-radius: 24px"] p[style*="0.9375rem"] {
        font-size: 0.82rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Serve card feature tags */
    div[style*="flex-wrap: wrap"] span[style*="border-radius: 50px"] {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.75rem !important;
    }
}

/* Keep 2×2 on medium mobile (641-768) */
@media (min-width: 641px) and (max-width: 768px) {
    div[style*="grid-template-columns: repeat(2, 1fr)"][style*="gap: 2rem"] {
        gap: 1rem !important;
    }

    div[style*="border-radius: 24px"][style*="padding: 2.5rem"] {
        padding: 1.25rem !important;
    }
}

/* ── 5. COLOR PALETTE: Force exactly 2 columns on mobile ── */
/* minmax(200px,1fr) shows partial 4th card; override to 2-col */
@media (max-width: 600px) {
    .color-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 2rem !important;
    }

    /* Taller swatch preview so colors are visible */
    .swatch-preview {
        height: 110px !important;
    }

    .swatch-info {
        padding: 0.75rem !important;
    }

    .swatch-name { font-size: 0.85rem !important; }
    .swatch-code { font-size: 0.75rem !important; }

    /* Palette hero compact */
    .palette-hero {
        padding: 5rem 0 1rem !important;
    }

    .palette-hero h1 {
        font-size: clamp(1.8rem, 8vw, 3rem) !important;
        letter-spacing: -1px !important;
    }

    .palette-hero p { font-size: 0.95rem !important; }
}

@media (min-width: 601px) and (max-width: 900px) {
    .color-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
}

/* ── 6. PAINTING GUIDE TABLE: scrollable wrapper ── */
/* The table itself can't be targeted unless we add a wrapper via HTML.
   Using a CSS-only approach: make the parent card scrollable */
@media (max-width: 768px) {
    /* Make the modern-guide-card containing the table scroll horizontally */
    .modern-guide-card {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Ensure table doesn't shrink below readable width */
    .comparison-table-modern {
        min-width: 460px !important;
        width: 100% !important;
        font-size: 0.82rem !important;
    }

    .comparison-table-modern th {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.82rem !important;
        white-space: nowrap !important;
    }

    .comparison-table-modern td {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.82rem !important;
        line-height: 1.4 !important;
    }

    /* First column — the aspect labels */
    .comparison-table-modern td:first-child,
    .comparison-table-modern th:first-child {
        min-width: 100px !important;
    }

    /* Other columns */
    .comparison-table-modern td:not(:first-child),
    .comparison-table-modern th:not(:first-child) {
        min-width: 140px !important;
    }
}

/* ── 7. PRODUCTS: fix minmax(300px,1fr) overflow ── */
/* At ≤640px, 300px min means only 1 card fits + overflow.
   Force 2-col with auto sizing. */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.875rem !important;
    }

    /* Compact card body */
    .product-card-body { padding: 0.875rem !important; }

    .product-card-title {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.4rem !important;
    }

    .product-card-description {
        font-size: 0.82rem !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        margin-bottom: 0.75rem !important;
    }

    .product-card-image { height: 160px !important; }

    /* Price + button: stack vertically */
    .product-card-price-row,
    .product-card-footer {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: flex-start !important;
    }

    .product-card-footer .btn,
    .product-card-price-row .btn {
        width: 100% !important;
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
        text-align: center !important;
        justify-content: center !important;
    }

    /* Feature pills — limit to 2 visible */
    .product-card-features {
        gap: 0.3rem !important;
        margin-bottom: 0.75rem !important;
    }

    .product-card-feature {
        padding: 0.2rem 0.5rem !important;
        font-size: 0.72rem !important;
    }

    /* Products hero compact */
    .products-hero {
        padding: 5rem 0 2rem !important;
        min-height: auto !important;
    }

    .hero-glass-card {
        padding: 1.5rem !important;
        border-radius: 20px !important;
    }

    .hero-title { font-size: clamp(1.8rem, 6vw, 2.8rem) !important; }
    .hero-subtitle { font-size: 0.95rem !important; }
}

@media (max-width: 400px) {
    /* Very small phones: 1 column */
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .product-card-image { height: 180px !important; }
}

/* ── 8. GALLERY: fix minmax(350px,1fr) — items cut off ── */
/* 350px min on 375px viewport = overflow. Explicit 2-col. */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 0 !important;
    }

    .gallery-item {
        height: auto !important;        /* remove fixed 450px height */
        min-height: 0 !important;
        border-radius: 14px !important;
    }

    .gallery-image-container {
        height: 160px !important;       /* compact image area */
        border-radius: 0 !important;
    }

    .gallery-content {
        padding: 0.875rem !important;
    }

    .gallery-content h3 {
        font-size: 0.9rem !important;
        margin-bottom: 0.25rem !important;
        white-space: normal !important;   /* allow wrap */
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
    }

    .gallery-content p {
        font-size: 0.78rem !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
    }

    /* Touch nav arrows always visible on mobile */
    .card-nav { opacity: 1 !important; pointer-events: auto !important; }

    .card-nav-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.75rem !important;
    }

    .gallery-section {
        padding-top: 100px !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .gallery-title {
        font-size: clamp(1.6rem, 6vw, 2.5rem) !important;
        padding: 0 !important;
    }

    .gallery-subtitle {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
        padding: 0 !important;
    }

    /* Pagination compact */
    .pagination-controls {
        flex-wrap: wrap !important;
        gap: 6px !important;
        margin-top: 1.5rem !important;
    }

    .pagination-btn {
        padding: 8px 14px !important;
        font-size: 0.82rem !important;
    }

    .pagination-info {
        width: 100% !important;
        text-align: center !important;
        margin: 0 !important;
        order: -1;
    }
}

@media (max-width: 430px) {
    /* Single column on very small phones */
    .gallery-grid {
        grid-template-columns: 1fr !important;
    }

    .gallery-image-container { height: 200px !important; }

    .gallery-item { border-radius: 16px !important; }
}

/* END PATCH v2 */

/* ── NAVBAR CTA MOBILE ITEM: hide on desktop, show in overlay ── */

/* Hide the in-menu Shop Now on desktop (pill nav shows proper CTA) */
.navbar-cta-mobile { display: none !important; }

/* On mobile: show it inside the full-screen overlay */
@media (max-width: 768px) {
    .navbar-cta-mobile {
        display: list-item !important;
        list-style: none !important;
        width: 100% !important;
        text-align: center !important;
        margin-top: 0.5rem !important;
    }

    .navbar-cta-mobile a.btn {
        display: inline-block !important;
        min-width: 200px !important;
        padding: 0.75rem 2rem !important;
        font-size: 1rem !important;
        border-radius: 100px !important;
        min-height: 44px !important;
    }
}

/* END NAVBAR PATCH */

/* ============================================================
   PATCH v3 — Targeted fixes
   1. Color-palette "Understanding Paint Colors" 2-panel overlap
   2. Index milestone products half-screen fix
   3. Footer compress on mobile (all pages)
   4. Admin login + dashboard mobile UI
   ============================================================ */

/* ─── 1. COLOR-PALETTE: Understanding Paint Colors 2-panel grid ─── */
/* Root cause: inline style "minmax(300px,1fr)" — on <480px viewport
   both panels can't fit. Override to single column. */
@media (max-width: 640px) {
    /* Target the exact inline grid wrapping the two edu-cards */
    .content-panel div[style*="minmax(300px, 1fr)"],
    .content-panel div[style*="minmax(300px,1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    /* Compact the edu-cards themselves */
    .content-panel .edu-card {
        padding: 1.25rem !important;
        border-radius: 16px !important;
    }

    .content-panel .edu-card h3 {
        font-size: 1.15rem !important;
        margin-bottom: 0.625rem !important;
    }

    .content-panel .edu-card p,
    .content-panel .edu-card ul {
        font-size: 0.875rem !important;
        line-height: 1.6 !important;
        margin-bottom: 1rem !important;
    }

    .content-panel .edu-card li {
        margin-bottom: 0.625rem !important;
    }

    /* content-panel outer padding */
    .content-panel {
        padding: 1.5rem 1rem !important;
        border-radius: 20px !important;
    }
}

/* On medium-mobile keep 2-col but tighten gap */
@media (min-width: 641px) and (max-width: 900px) {
    .content-panel div[style*="minmax(300px, 1fr)"],
    .content-panel div[style*="minmax(300px,1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
}

/* ─── 2. INDEX: Milestone Products — fix half-screen card width ─── */
/* Root cause: milestone-product-card has flex: 0 0 350px
   On a 390px phone that's 350px leaving only 40px — looks half-screen.
   Fix: make card width responsive to viewport. */
@media (max-width: 768px) {
    .milestone-products {
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0 !important;
        /* Let it bleed edge-to-edge */
        margin: 0 -1rem !important;
        padding: 0 1rem !important;
    }

    .milestone-products-container {
        display: flex !important;
        gap: 1rem !important;
        padding: 0.5rem 0 1rem !important;
        /* Right padding so last card doesn't hug edge */
        padding-right: 1.5rem !important;
    }

    .milestone-product-card {
        /* Was 350px — now 80vw so it peeks the next card nicely */
        flex: 0 0 80vw !important;
        max-width: 300px !important;
        scroll-snap-align: start !important;
    }

    /* Compact the card image */
    .milestone-product-card .product-card-image {
        height: 160px !important;
    }

    /* Compact the card body */
    .milestone-product-card .product-card-body {
        padding: 1rem !important;
    }

    .milestone-product-card .product-card-title {
        font-size: 1rem !important;
    }

    .milestone-product-card .product-card-description {
        font-size: 0.85rem !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        margin-bottom: 0.75rem !important;
    }

    /* Section panel padding */
    .glass-section-panel[style*="padding: 4rem"] {
        padding: 1.5rem 1rem !important;
        border-radius: 24px !important;
    }
}

@media (max-width: 480px) {
    .milestone-product-card {
        flex: 0 0 85vw !important;
        max-width: 260px !important;
    }
}

/* ─── 3. FOOTER: Compress on mobile — ALL pages ─── */
@media (max-width: 768px) {

    /* ── Outer island ── */
    .footer-floating-island {
        padding: 1.75rem 1rem 1.25rem !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    /* ── 4-col grid → 2-col then 1-col ── */
    .footer-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* ── Brand column ── */
    /* Logo + title row */
    .footer-floating-island > div > div:first-child
    div[style*="display: flex"][style*="align-items: center"] {
        gap: 0.625rem !important;
        margin-bottom: 0.875rem !important;
    }

    /* Big brand name "natural" */
    .footer-floating-island h3[style*="2.3rem"],
    .footer-floating-island h3[style*="font-size: 2.3rem"] {
        font-size: 1.3rem !important;
        margin: 0 !important;
    }

    /* Logo icon box */
    .footer-floating-island div[style*="width: 50px"][style*="height: 50px"] {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
    }

    /* Description text */
    .footer-floating-island p[style*="line-height: 1.8"] {
        font-size: 0.82rem !important;
        line-height: 1.6 !important;
        margin-bottom: 1rem !important;
    }

    /* Social icons row */
    .footer-floating-island div[style*="display: flex"][style*="gap: 0.75rem"][style*="flex-wrap"] {
        gap: 0.5rem !important;
    }

    .footer-floating-island a[style*="width: 42px"][style*="height: 42px"] {
        width: 34px !important;
        height: 34px !important;
        border-radius: 8px !important;
    }

    /* ── Section headings ── */
    .footer-floating-island h4[style*="font-size: 1rem"] {
        font-size: 0.8rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* ── Quick Links ── */
    .footer-floating-island ul li a[style*="font-size: 0.95rem"] {
        font-size: 0.82rem !important;
    }

    /* ── Product tag pills ── */
    .footer-floating-island a[style*="padding: 0.6rem 1rem"][style*="border-radius: 10px"] {
        padding: 0.4rem 0.625rem !important;
        font-size: 0.78rem !important;
        border-radius: 8px !important;
    }

    .footer-floating-island a[style*="padding: 0.6rem 1rem"] span[style*="font-size: 1.1rem"] {
        font-size: 0.9rem !important;
    }

    /* ── Contact items ── */
    .footer-floating-island div[style*="width: 38px"][style*="height: 38px"] {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
    }

    .footer-floating-island p[style*="font-size: 0.75rem"] {
        font-size: 0.68rem !important;
    }

    .footer-floating-island p[style*="font-size: 0.95rem"],
    .footer-floating-island p[style*="font-size: 0.9rem"],
    .footer-floating-island p[style*="font-size: 0.88rem"] {
        font-size: 0.8rem !important;
    }

    /* ── Footer bottom bar ── */
    .footer-floating-island > div[style*="border-top"] {
        padding-top: 1rem !important;
    }

    .footer-floating-island div[style*="justify-content: space-between"][style*="flex-wrap"] {
        flex-direction: column !important;
        gap: 0.625rem !important;
        align-items: flex-start !important;
    }

    .footer-floating-island p[style*="font-size: 0.9rem"][style*="margin: 0"] {
        font-size: 0.78rem !important;
    }

    .footer-floating-island div[style*="gap: 1.5rem"][style*="align-items: center"] {
        gap: 1rem !important;
        flex-wrap: wrap !important;
    }

    .footer-floating-island a[style*="font-size: 0.9rem"][style*="font-weight: 500"] {
        font-size: 0.78rem !important;
    }
}

/* On very small phones collapse to 1-col */
@media (max-width: 480px) {
    .footer-grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
}

/* ─── 4a. ADMIN LOGIN (admin/index.html) ─── */
@media (max-width: 480px) {
    /* Center login card, fill screen with breathing room */
    .login-card {
        padding: 2rem 1.5rem !important;
        border-radius: 20px !important;
        margin: 1rem !important;
        width: calc(100% - 2rem) !important;
        max-width: none !important;
    }

    /* Logo image */
    .login-card .login-logo img {
        height: 70px !important;
        margin-bottom: 0.875rem !important;
    }

    /* Brand name */
    .login-card .login-logo div[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }

    .login-card .logo-text-small {
        font-size: 0.7rem !important;
    }

    /* Inputs */
    .login-card .form-input {
        font-size: 16px !important; /* prevent iOS zoom */
        padding: 0.75rem 0.875rem !important;
    }

    .login-card .btn-login {
        padding: 0.875rem !important;
        font-size: 0.95rem !important;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 1.5rem 1.25rem !important;
    }
}

/* ─── 4b. ADMIN DASHBOARD — Complete Mobile Responsive UI ─── */

/* ════════════════════════════════════════════
   SIDEBAR: Full-height off-canvas drawer
   ════════════════════════════════════════════ */
@media (max-width: 1024px) {

    /* Sidebar is full-height fixed drawer */
    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 260px !important;
        z-index: 300 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.15) !important;
        overflow-y: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .admin-sidebar.open {
        transform: translateX(0) !important;
    }

    /* Overlay behind sidebar */
    .sidebar-overlay {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.5) !important;
        z-index: 299 !important;
        backdrop-filter: blur(2px) !important;
    }
    .sidebar-overlay.visible {
        display: block !important;
    }

    /* Logout section always at bottom of sidebar */
    .admin-sidebar > div[style*="border-top"] {
        margin-top: auto !important;
        border-top: 1px solid rgba(0,0,0,0.08) !important;
        padding: 1rem !important;
    }

    /* Sidebar nav items */
    .admin-nav {
        flex: 1 !important;
        overflow-y: auto !important;
        padding: 1rem !important;
    }

    .nav-item {
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
        margin-bottom: 0.25rem !important;
        cursor: pointer !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Main content: no left offset */
    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* ════════ HEADER ════════ */
    .admin-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 200 !important;
        padding: 0 1rem !important;
        gap: 0.75rem !important;
        display: flex !important;
        align-items: center !important;
        height: 58px !important;
    }

    /* Hamburger button */
    .admin-menu-btn {
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        padding: 8px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
        min-width: 38px !important;
        min-height: 38px !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .admin-menu-btn:hover { background: #f3f4f6 !important; }
    .admin-menu-btn span {
        display: block !important;
        width: 22px !important;
        height: 2.5px !important;
        background: #374151 !important;
        border-radius: 2px !important;
        transition: all 0.3s !important;
    }

    .admin-title { font-size: 1.05rem !important; flex: 1; }
    .admin-user-menu { gap: 0.5rem !important; }
    #adminUserEmail { display: none; } /* hide email on mobile, save space */

    /* ════════ CONTENT PADDING ════════ */
    .admin-content {
        padding: 1rem !important;
    }

    /* ════════ STATS GRID ════════ */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1.25rem !important;
    }

    .stat-card {
        padding: 0.875rem 0.75rem !important;
        border-radius: 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    .stat-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        border-radius: 10px !important;
    }

    .stat-info h3 { font-size: 0.72rem !important; line-height: 1.3 !important; }
    .stat-info p  { font-size: 1.2rem !important; }

    /* ════════ TABLE CONTAINER ════════ */
    .table-container {
        border-radius: 14px !important;
        overflow: hidden !important;
    }

    .table-header {
        padding: 1rem !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
    }

    .table-header h3 { font-size: 0.95rem !important; margin: 0 !important; }
    .table-header p  { font-size: 0.78rem !important; margin: 2px 0 0 !important; }

    .table-header .btn {
        padding: 0.4rem 0.875rem !important;
        font-size: 0.78rem !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
    }

    /* ════════ TABLE RESPONSIVE WRAPPER ════════ */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .admin-table {
        min-width: 560px !important;
        font-size: 0.82rem !important;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.875rem !important;
        font-size: 0.82rem !important;
        white-space: nowrap !important;
    }

    .status-badge {
        padding: 0.2rem 0.625rem !important;
        font-size: 0.72rem !important;
        white-space: nowrap !important;
    }

    /* ════════ PRODUCT GRID (admin) ════════ */
    .admin-content .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.875rem !important;
        padding: 0.5rem 0 !important;
    }

    .product-image-container { height: 160px !important; }

    .product-info {
        padding: 0.875rem !important;
    }
    .product-category { font-size: 0.7rem !important; }
    .product-title    { font-size: 0.9rem !important; line-height: 1.3 !important; }
    .current-price    { font-size: 1rem !important; }
    .original-price   { font-size: 0.8rem !important; }

    .product-actions {
        padding: 0.625rem 0.875rem !important;
        gap: 0.5rem !important;
    }
    .action-btn {
        padding: 0.5rem 0.625rem !important;
        font-size: 0.76rem !important;
        border-radius: 8px !important;
    }

    /* ════════ MESSAGES GRID ════════ */
    .messages-grid {
        grid-template-columns: 1fr !important;
        gap: 0.875rem !important;
        padding: 0 !important;
    }

    .message-card {
        padding: 1.1rem !important;
        border-radius: 16px !important;
        gap: 0.875rem !important;
    }

    .message-header { padding-bottom: 0.75rem !important; }

    .message-avatar {
        width: 42px !important;
        height: 42px !important;
        font-size: 1rem !important;
        border-radius: 12px !important;
    }

    .message-meta h4 { font-size: 0.95rem !important; }
    .message-meta p  { font-size: 0.78rem !important; }
    .message-date    { font-size: 0.7rem !important; }

    .message-body {
        font-size: 0.875rem !important;
        -webkit-line-clamp: 3 !important;
        min-height: auto !important;
    }

    .message-actions { padding-top: 0.75rem !important; gap: 0.5rem !important; }
    .message-btn     { padding: 0.6rem 0.5rem !important; font-size: 0.8rem !important; }
    .btn-msg-delete  { width: 36px !important; height: 36px !important; }

    /* Message header panel */
    .table-header.bg-white[style*="margin-bottom: 2rem"] {
        padding: 0.875rem 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* ════════ GALLERY GRID (admin) ════════ */
    /* Gallery items use same product-grid class */

    /* ════════ MODALS ════════ */
    .modal-content-modern {
        width: 96% !important;
        max-width: none !important;
        max-height: 90vh !important;
        border-radius: 20px !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    .modal-header {
        padding: 1rem 1.25rem !important;
    }
    .modal-header h2 { font-size: 1.1rem !important; }
    .modal-header div h2 { font-size: 1.1rem !important; } /* gallery modal */
    .modal-header div p  { font-size: 0.82rem !important; }

    .modal-body {
        overflow-y: auto !important;
    }

    /* Product modal tabs */
    .tabs {
        padding: 0 0.75rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
        gap: 0 !important;
    }

    .tab-item {
        padding: 0.75rem 0.875rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    .tab-content { padding: 1.1rem !important; }

    /* Form rows (2-col) → stack on mobile */
    .tab-content .row,
    .modal-body .row {
        flex-direction: column !important;
        gap: 0 !important;
    }

    .modern-input {
        font-size: 16px !important; /* prevent iOS zoom */
    }

    /* Form section */
    .form-section { padding: 1rem !important; }

    /* Upload area */
    .upload-area {
        padding: 1.5rem 1rem !important;
    }
    .upload-icon { font-size: 1.75rem !important; margin-bottom: 0.625rem !important; }
    .upload-area h4 { font-size: 0.95rem !important; }
    .upload-area p  { font-size: 0.8rem !important; }

    /* Modal footer */
    .modal-footer {
        padding: 0.875rem 1.25rem !important;
        gap: 0.5rem !important;
    }
    .modal-footer .btn,
    .modal-footer button {
        padding: 0.625rem 1.1rem !important;
        font-size: 0.85rem !important;
    }

    /* Gallery modal specific — 2-col form grid → 1-col */
    #galleryModal .modal-body div[style*="grid-template-columns: 1fr 1fr"],
    .modal-body div[style*="grid-template-columns: 1fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    /* Gallery modal footer buttons */
    #galleryModal div[style*="modal-footer"],
    div[style*="padding: 1.5rem 2rem"][style*="border-top"][style*="flex-end"] {
        padding: 0.875rem 1.25rem !important;
        gap: 0.5rem !important;
    }

    div[style*="padding: 1.5rem 2rem"][style*="border-top"] button {
        padding: 0.625rem 1rem !important;
        font-size: 0.85rem !important;
    }

    /* Preview grid for uploaded media */
    #galleryPreviewContainer {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.625rem !important;
        margin-top: 1rem !important;
    }

    /* Detail row in orders table */
    .detail-content {
        padding: 0.875rem 1rem !important;
    }

    /* Delete confirm modals */
    div[style*="max-width:400px"][style*="border-radius:24px"],
    div[style*="max-width: 400px"][style*="border-radius: 24px"] {
        padding: 1.75rem 1.25rem !important;
        border-radius: 20px !important;
    }

    /* ════════ ADD NEW buttons ════════ */
    .table-header .btn-primary,
    .table-header button.btn-primary {
        font-size: 0.8rem !important;
        padding: 0.45rem 0.875rem !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 480px) {
    /* Stats: 1 row of 3 still fits or collapse to 2+1 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Products: 1 col on small phones */
    .admin-content .product-grid {
        grid-template-columns: 1fr !important;
    }

    .product-image-container { height: 180px !important; }

    /* Table: wider min so important cols show */
    .admin-table { min-width: 480px !important; }

    /* Modal wider on small phones */
    .modal-content-modern { width: 98% !important; border-radius: 16px !important; }

    /* Gallery preview 2-col on tiny phones */
    #galleryPreviewContainer {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* END ADMIN MOBILE */
/* ─── 4b. ADMIN DASHBOARD — Complete Mobile Responsive UI ─── */

/* ════════════════════════════════════════════
   SIDEBAR: Full-height off-canvas drawer
   ════════════════════════════════════════════ */
@media (max-width: 1024px) {

    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 260px !important;
        z-index: 300 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.15) !important;
        overflow-y: auto !important;
        display: flex !important;
        flex-direction: column !important;
        background: white !important;
    }

    .admin-sidebar.open {
        transform: translateX(0) !important;
    }

    /* Logout always at bottom */
    .admin-sidebar > div[style*="border-top"],
    .admin-sidebar > div:last-child {
        margin-top: auto !important;
        border-top: 1px solid rgba(0,0,0,0.08) !important;
        padding: 1rem !important;
    }

    .admin-nav {
        flex: 1 !important;
        overflow-y: auto !important;
        padding: 1rem !important;
    }

    .nav-item {
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
        margin-bottom: 0.25rem !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        cursor: pointer !important;
    }

    /* Overlay behind open sidebar */
    .sidebar-overlay {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.5) !important;
        z-index: 299 !important;
        backdrop-filter: blur(2px) !important;
    }
    .sidebar-overlay.visible {
        display: block !important;
    }

    /* Main: no left margin */
    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* ════ HEADER ════ */
    .admin-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 200 !important;
        padding: 0 1rem !important;
        height: 58px !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
    }

    .admin-menu-btn {
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4.5px !important;
        padding: 8px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
        min-width: 38px !important;
        min-height: 38px !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .admin-menu-btn:hover { background: #f3f4f6 !important; }
    .admin-menu-btn span {
        display: block !important;
        width: 22px !important;
        height: 2.5px !important;
        background: #374151 !important;
        border-radius: 2px !important;
    }

    .admin-title { font-size: 1rem !important; flex: 1 !important; }
    #adminUserEmail { display: none !important; }

    /* ════ CONTENT ════ */
    .admin-content { padding: 1rem !important; }

    /* ════ STATS ════ */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.625rem !important;
        margin-bottom: 1.25rem !important;
    }

    .stat-card {
        padding: 0.875rem 0.75rem !important;
        border-radius: 12px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.4rem !important;
    }

    .stat-icon {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.1rem !important;
        border-radius: 10px !important;
    }

    .stat-info h3 { font-size: 0.7rem !important; }
    .stat-info p  { font-size: 1.15rem !important; }

    /* ════ TABLE AREA ════ */
    .table-container {
        border-radius: 12px !important;
        overflow: hidden !important;
    }

    .table-header {
        padding: 0.875rem 1rem !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
    }

    .table-header h3 { font-size: 0.9rem !important; margin: 0 !important; }
    .table-header p  { font-size: 0.75rem !important; }

    /* ALL "Add" / action buttons in table headers */
    .table-header .btn,
    .table-header button {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.75rem !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
    }

    /* Scrollable table */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
    }

    .admin-table {
        min-width: 520px !important;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.7rem 0.875rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
    }

    .status-badge {
        font-size: 0.7rem !important;
        padding: 0.18rem 0.55rem !important;
    }

    /* ════ PRODUCT CARDS (admin products + gallery) ════ */
    .admin-content .product-grid,
    #productsGrid,
    #galleryGrid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.875rem !important;
        padding: 0.5rem 0 !important;
    }

    .product-image-container { height: 150px !important; }
    .product-info { padding: 0.875rem !important; }
    .product-category { font-size: 0.68rem !important; }
    .product-title    { font-size: 0.88rem !important; line-height: 1.3 !important; }
    .current-price    { font-size: 0.95rem !important; }
    .original-price   { font-size: 0.78rem !important; }

    .product-actions {
        padding: 0.6rem 0.875rem !important;
        gap: 0.5rem !important;
    }
    .action-btn {
        padding: 0.45rem 0.5rem !important;
        font-size: 0.74rem !important;
        border-radius: 7px !important;
    }

    /* ════ MESSAGES ════ */
    .messages-grid {
        grid-template-columns: 1fr !important;
        gap: 0.875rem !important;
    }

    .message-card { padding: 1rem !important; border-radius: 14px !important; gap: 0.75rem !important; }
    .message-avatar { width: 40px !important; height: 40px !important; font-size: 0.95rem !important; border-radius: 10px !important; }
    .message-meta h4 { font-size: 0.9rem !important; }
    .message-meta p  { font-size: 0.75rem !important; }
    .message-body    { font-size: 0.85rem !important; -webkit-line-clamp: 2 !important; min-height: auto !important; }
    .message-actions { padding-top: 0.75rem !important; gap: 0.5rem !important; }
    .message-btn     { padding: 0.55rem !important; font-size: 0.78rem !important; }
    .btn-msg-delete  { width: 34px !important; height: 34px !important; border-radius: 10px !important; }

    /* Message section header */
    .table-header.bg-white { padding: 0.875rem 1rem !important; margin-bottom: 0.875rem !important; }

    /* ════ MODALS ════ */
    .modal-content-modern {
        width: 95% !important;
        max-height: 88vh !important;
        border-radius: 18px !important;
    }

    .modal-header {
        padding: 1rem 1.25rem !important;
    }
    .modal-header h2 { font-size: 1.05rem !important; }

    /* Tabs: horizontal scroll */
    .tabs {
        padding: 0 0.75rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
    }

    .tab-item {
        padding: 0.7rem 0.875rem !important;
        font-size: 0.78rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    .tab-content { padding: 1.1rem !important; }

    /* 2-col form rows → stack */
    .row { flex-direction: column !important; gap: 0 !important; }

    /* Gallery form 2-col grid → stack */
    .modal-body div[style*="grid-template-columns: 1fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
    }

    /* inputs: prevent iOS zoom */
    .modern-input,
    .modal-content-modern input,
    .modal-content-modern select,
    .modal-content-modern textarea {
        font-size: 16px !important;
    }

    .upload-area { padding: 1.25rem 1rem !important; }

    .modal-footer {
        padding: 0.875rem 1.25rem !important;
        gap: 0.5rem !important;
    }
    .modal-footer .btn,
    .modal-footer button { padding: 0.625rem 1rem !important; font-size: 0.82rem !important; }

    /* Gallery modal inline-style footer */
    div[style*="padding: 1.5rem 2rem"][style*="border-top: 1px solid #f3f4f6"] {
        padding: 0.875rem 1.25rem !important;
    }
    div[style*="padding: 1.5rem 2rem"][style*="border-top: 1px solid #f3f4f6"] button {
        padding: 0.625rem 1rem !important;
        font-size: 0.82rem !important;
    }

    /* Media preview grid */
    #galleryPreviewContainer {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.625rem !important;
    }

    /* Delete confirm modals */
    .modal-content-modern[style*="max-width:400px"],
    .modal-content-modern[style*="max-width: 400px"] {
        padding: 1.75rem 1.25rem !important;
    }

    /* Detail row */
    .detail-content { padding: 0.875rem 1rem !important; }

    /* Admin logo */
    .admin-logo { padding: 0 1rem !important; gap: 8px !important; }
    .admin-logo img { height: 32px !important; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

    .admin-content .product-grid,
    #productsGrid,
    #galleryGrid {
        grid-template-columns: 1fr !important;
    }

    .product-image-container { height: 170px !important; }

    .admin-table { min-width: 460px !important; }

    .modal-content-modern { width: 98% !important; border-radius: 14px !important; }

    #galleryPreviewContainer {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* END ADMIN MOBILE */
