/* ==========================================================================
   PART 1: GLOBAL LAYOUT RULES, FORM INFRASTRUCTURE & DESKTOP CORE PANELS
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    display: flex;
    background-color: #f4f6f9;
    min-height: 100vh;
    width: 100%;
    color: #1e293b;
    overflow-x: hidden;
    position: relative;
}

/* --- Dynamic Notification Alerts --- */
.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    padding: 14px 20px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    padding: 14px 20px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid #fca5a5;
}

/* --- Panel Layout Blocks --- */
.module-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 20px;
}

.form-panel, .table-panel {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}

.module-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.panel-title {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- 4-Column Form Grid System --- */
.form-row-quad {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 4px;
}

.col-quad {
    flex: 1 1 calc(25% - 12px);
    min-width: 200px;
}
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 13.5px;
    color: #1e293b;
    background-color: #ffffff;
    transition: border-color 0.15s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-panel textarea {
    width: 100%;
    height: 72px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 13.5px;
    color: #1e293b;
    resize: vertical;
}

.form-actions-wrapper {
    margin-top: 10px;
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
    display: flex;
    justify-content: flex-start;
}

/* --- Primary Control Panel Action Buttons --- */
.btn-primary {
    background-color: #1e293b;
    color: #ffffff;
    border: none;
    padding: 11px 24px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary:hover { background-color: #0f172a; }

.btn-secondary {
    display: inline-block;
    text-align: center;
    background-color: #f1f5f9;
    color: #475569;
    text-decoration: none;
    padding: 11px 24px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    margin-left: 10px;
    transition: background 0.15s ease;
}

.btn-secondary:hover { background-color: #e2e8f0; }

/* --- Table Filter & Action Bars --- */
.action-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}
.search-wrapper {
    position: relative;
    flex-grow: 1;
    min-width: 200px;
}

.search-input {
    width: 100%;
    padding: 11px 14px 11px 36px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 13.5px;
    background-color: #f8fafc;
    color: #334155;
}

.search-icon-placeholder {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.btn-export {
    background-color: #10b981;
    color: #ffffff;
    border: none;
    padding: 11px 18px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease;
}

.btn-export:hover { background-color: #059669; }
.filter-checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; user-select: none; }

/* --- Data Table Design Layers --- */
.table-responsive-wrapper {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    white-space: nowrap;
}

.data-table th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
}

.data-table tbody tr:hover { background-color: #f8fafc; }

/* --- Component Status Badges --- */
.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
}
.status-available { background-color: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.status-reserved { background-color: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.status-sold { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.badge-category { background-color: #f1f5f9; color: #334155; padding: 3px 6px; border-radius: 3px; font-size: 11.5px; border: 1px solid #e2e8f0; }

/* --- Media Asset Previews & Actions --- */
.table-thumb-preview { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid #e2e8f0; }
.thumb-preview-form { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; border: 1px solid #cbd5e1; }
.avatar-placeholder { width: 36px; height: 36px; background-color: #f1f5f9; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #94a3b8; border: 1px solid #e2e8f0; }

.action-buttons-cell { 
    display: flex; 
    gap: 4px; 
    justify-content: flex-end;
}

.btn-table-action { 
    text-decoration: none; 
    font-size: 11.5px; 
    font-weight: 600; 
    padding: 4px 8px; 
    border-radius: 3px; 
    transition: all 0.15s ease; 
}

.btn-edit { background-color: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.btn-edit:hover { background-color: #2563eb; color: #ffffff; }
.btn-delete { background-color: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.btn-delete:hover { background-color: #dc2626; color: #ffffff; }

/* ==========================================================================
   PART 2: DESKTOP DRAWERS, HORIZONTAL ACCOUNTING FIXES & MOBILE LAYOUTS
   ========================================================================== */

/* --- Persistent Desktop Left Sidebar --- */
.sidebar {
    width: 260px;
    height: 100vh;
    background-color: #1e2838;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid #141c26;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #28354a;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-header h5 {
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.75px;
    text-transform: uppercase;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.15s ease;
    border-left: 4px solid transparent;
}

.sidebar-menu li a svg {
    margin-right: 12px;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.sidebar-menu li a:hover { color: #ffffff; background-color: #243146; }
.sidebar-menu li a.active { color: #ffffff; background-color: #28354a; border-left-color: #3b82f6; }

.inventory-viewport {
    margin-left: 260px;
    padding: 30px;
    width: calc(100% - 260px);
    flex-grow: 1;
}

/* --- Mobile Sticky Top Bar (Hidden on Desktops) --- */
.mobile-nav-header {
    display: none;
    width: 100%;
    background-color: #171a21;
    padding: 14px 20px;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1100;
    border-bottom: 1px solid #141c26;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-brand {
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* --- Pure CSS 3-Line Hamburger Trigger --- */
.menu-toggle-btn {
    background: none;
    border: 1px solid #2d3545;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 42px;
    height: 36px;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.menu-toggle-btn:hover { background-color: #243146; }

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #e2e8f0;
    border-radius: 1px;
    transition: all 0.2s ease-in-out;
}

.menu-toggle-btn.open-active .hamburger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle-btn.open-active .hamburger-line:nth-child(2) { opacity: 0; }
.menu-toggle-btn.open-active .hamburger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   FIXED DESKTOP VIEWPORT HORIZONTAL DASHBOARD BOXES REGULATION ENGINE
   ========================================================================== */
.form-row-quad {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    width: 100% !important;
    margin-bottom: 30px !important;
}

.form-row-quad .form-panel {
    flex: 1 !important;
    width: auto !important;
    margin: 0 !important;
}

/* ==========================================================================
   DYNAMIC WEB MEDIA RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media screen and (max-width: 1024px) {
    .col-quad { flex: 1 1 calc(50% - 16px); }
}

@media screen and (max-width: 768px) {
    body { 
        flex-direction: column !important; 
    }
    
    .mobile-nav-header { 
        display: flex !important; 
    }

    .form-row-quad {
        flex-direction: column !important;
        flex-wrap: wrap !important;
        gap: 16px !important;
    }
    
    .form-row-quad .form-panel {
        width: 100% !important;
    }

    /* Off-canvas layout defaults sidebar out of viewport limits on mobile screens */
    .sidebar {
        position: fixed !important;
        top: 53px !important;
        left: 0 !important;
        width: 260px !important;
        height: calc(100vh - 53px) !important;
        border-right: 1px solid #141c26;
        box-shadow: 4px 0 10px rgba(0,0,0,0.15);
        display: flex !important;
        flex-direction: column !important;
        
        /* FIXED: Changed from hidden to auto to allow the sidebar tray to scroll down on small devices */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        
        transform: translateX(-100%) !important;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    /* Dynamic slider state layer configuration to reveal menu tray smoothly */
    .sidebar.mobile-open { 
        transform: translateX(0) !important; 
    }

    .sidebar-header { 
        display: none !important; 
    }
    
    .sidebar-mobile-close-bar { 
        display: none !important; 
    }
    
    .sidebar-menu li a { 
        padding: 16px 24px !important; 
        font-size: 15px !important; 
    }

    .inventory-viewport { 
        margin-left: 0 !important; 
        margin-top: 53px !important; 
        padding: 16px !important; 
        width: 100% !important; 
    }
}

@media screen and (max-width: 580px) {
    .col-quad { 
        flex: 1 1 100% !important; 
    }
    
    .action-filter-row { 
        flex-direction: column !important; 
        align-items: stretch !important; 
    }
    
    .action-filter-row div, 
    .action-filter-row select, 
    .action-filter-row input, 
    .action-filter-row .btn-export { 
        width: 100% !important; 
    }
    
    .form-panel, 
    .table-panel { 
        padding: 16px !important; 
    }
}
