/* =============================================================
   S&R Technologies – Responsive Overrides
   Breakpoints:
     xs  < 640px   (phones portrait)
     sm  640px     (phones landscape)
     md  768px     (tablets portrait / iPad Air 2 portrait)
     lg  1024px    (tablets landscape / iPad Air 2 landscape)
     xl  1280px    (laptops)
   ============================================================= */

/* ------------------------------------------------------------
   SIDEBAR: show as static column at lg (1024px) and above
   ------------------------------------------------------------ */
@media (min-width: 1024px) {
    #sidebar {
        position: static !important;
        transform: translateX(0) !important;
        -webkit-transform: translateX(0) !important;
        display: flex !important;
        flex-shrink: 0;
    }
    #toggleSidebar {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
}

/* Below lg: sidebar overlays from the left */
@media (max-width: 1023.9px) {
    #sidebar {
        position: fixed !important;
        z-index: 50 !important;
        transform: translateX(-100%) !important;
        -webkit-transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
    }
    #sidebar.open,
    #sidebar:not(.-translate-x-full) {
        transform: translateX(0) !important;
        -webkit-transform: translateX(0) !important;
    }
}

/* ------------------------------------------------------------
   TABLES: show desktop tables at lg, hide mobile cards
   ------------------------------------------------------------ */
@media (min-width: 1024px) {
    .hidden.lg\:block  { display: block !important; }
    .lg\:hidden        { display: none  !important; }
    .hidden.lg\:flex   { display: flex  !important; }
}
@media (max-width: 1023.9px) {
    .lg\:hidden:not(.hidden)  { display: block !important; }
    .hidden.lg\:block          { display: none  !important; }
    .hidden.lg\:flex           { display: none  !important; }
    .hidden                    { display: none  !important; }
}

/* ------------------------------------------------------------
   TABLE CELLS: compact on tablet-sized desktops
   ------------------------------------------------------------ */
@media (min-width: 1024px) and (max-width: 1279.9px) {
    /* Reduce cell padding & font so tables fit in 1024px viewport */
    .view-section table th,
    .view-section table td {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
        font-size: 0.775rem !important;
    }
    /* Tighten fixed-width action columns */
    .view-section table th.w-36,
    .view-section table td.w-36 {
        width: 7rem !important;
    }
    /* Reduce inner padding across content views */
    .view-section {
        padding: 1rem !important;
    }
    /* Stat cards: tighter on tablet */
    .view-section .p-6 {
        padding: 1rem !important;
    }
    /* Dashboard grid: 2 columns on tablet landscape */
    #view-dashboard .grid.xl\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Full padding restored at xl */
@media (min-width: 1280px) {
    .view-section table th,
    .view-section table td {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        font-size: 0.875rem !important;
    }
    .view-section table th.w-36,
    .view-section table td.w-36 {
        width: 9rem !important;
    }
}

/* ------------------------------------------------------------
   MODALS: full screen on small devices, centred on tablet+
   ------------------------------------------------------------ */
@media (max-width: 767.9px) {
    /* Make modals full-width on phone */
    .modal-overlay > div,
    .modal-overlay > .bg-white {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        overflow-y: auto;
    }
}

/* ------------------------------------------------------------
   CONTENT AREA PADDING: loosen on small screens
   ------------------------------------------------------------ */
@media (max-width: 767.9px) {
    .view-section {
        padding: 0.75rem !important;
    }
}

/* ------------------------------------------------------------
   HEADER: reduce gap on tablet
   ------------------------------------------------------------ */
@media (min-width: 1024px) and (max-width: 1279.9px) {
    header .flex.items-center.gap-6 {
        gap: 0.75rem !important;
    }
    /* Hide date string but keep time on tight screens */
    header #current-date {
        display: none !important;
    }
}

/* ------------------------------------------------------------
   TRUE 100% FLUID FULL-PAGE LAYOUT CONTAINERS
   ------------------------------------------------------------ */
.shop-wide-container {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}
@media (min-width: 640px) {
    .shop-wide-container {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
}
@media (min-width: 1024px) {
    .shop-wide-container {
        padding-left: 1.75rem !important;
        padding-right: 1.75rem !important;
    }
}
@media (min-width: 1440px) {
    .shop-wide-container {
        padding-left: 2.25rem !important;
        padding-right: 2.25rem !important;
    }
}
@media (min-width: 1920px) {
    .shop-wide-container {
        padding-left: 3rem !important;
        padding-right: 3rem !important;
    }
}

/* ------------------------------------------------------------
   SHOP PRODUCT GRID: Full-page dynamic column auto-fill
   ------------------------------------------------------------ */
@media (max-width: 639.9px) {
    /* Phone portrait & landscape: exactly 2 columns */
    #shop-container:not(.grid-cols-1) {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
    }
}
@media (min-width: 640px) and (max-width: 1023.9px) {
    /* Tablets (Sidebar hidden): 3 columns */
    #shop-container:not(.grid-cols-1) {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 1rem !important;
    }
}
@media (min-width: 1024px) and (max-width: 1399.9px) {
    /* Laptops (with sidebar): 3 columns */
    #shop-container:not(.grid-cols-1) {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 1.25rem !important;
    }
}
@media (min-width: 1400px) and (max-width: 1749.9px) {
    /* Desktop Full Width (with sidebar): 4 columns */
    #shop-container:not(.grid-cols-1) {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 1.25rem !important;
    }
}
@media (min-width: 1750px) {
    /* Wide screens (1080p+ full screen with sidebar): 5 columns */
    #shop-container:not(.grid-cols-1) {
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 1.5rem !important;
    }
}

/* ------------------------------------------------------------
   PRINT UTILITIES
   ------------------------------------------------------------ */
.print-advance { font-size: 0.9rem; line-height: 1.4; }

@media print {
    .print-pawing, .print-advance {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    .no-print { display: none !important; }
}

/* ------------------------------------------------------------
   COST BREAKDOWN PANEL FULL-WIDTH & SPACING
   ------------------------------------------------------------ */
#cost-breakdown-section {
    width: 100% !important;
}
#cost-breakdown-section.hidden {
    display: none !important;
}
.cost-breakdown-row {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
}
.cost-breakdown-row .cb-item-name {
    min-width: 160px !important;
    flex: 1 1 auto !important;
}
