/* ============================================================
   INVENTORY MANAGEMENT SYSTEM - MAIN STYLESHEET
   Modern SaaS Dashboard Design
   ============================================================ */

:root {
    --primary: #0d3b66;
    --primary-light: #1a5276;
    --primary-dark: #0a2d50;
    --accent: #3fa9f5;
    --accent-light: #6ec0f8;
    --warning: #ffb703;
    --danger: #e63946;
    --success: #2a9d8f;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans Lao', 'Inter', sans-serif;
    font-size: 14px;
    color: var(--gray-700);
    background: var(--gray-50);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;           /* Fixed height = viewport */
    background: var(--primary);
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(13, 59, 102, 0.3);
    overflow: hidden;        /* Prevent outer scroll */
}

.sidebar-brand {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: var(--navbar-height);
}

.brand-icon {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
    flex-shrink: 0;
}

.brand-text { flex: 1; overflow: hidden; }
.brand-name { display: block; font-size: 15px; font-weight: 700; color: white; white-space: nowrap; }
.brand-sub { display: block; font-size: 11px; color: rgba(255,255,255,0.5); }
.sidebar-close { display: none; background: none; border: none; color: rgba(255,255,255,0.6); font-size: 18px; cursor: pointer; }

.sidebar-user {
    padding: 16px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: white; font-size: 16px;
    flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px; margin-top: 2px; }
.role-admin { background: rgba(255,183,3,0.25); color: var(--warning); }
.role-staff { background: rgba(63,169,245,0.25); color: var(--accent-light); }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scroll-behavior: smooth;
    overscroll-behavior: contain;  /* prevent page scroll bleed */
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.45); }

.nav-section { margin-bottom: 8px; }
.nav-label { display: block; font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 1px; padding: 8px 20px 4px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
    font-size: 13.5px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-item.active {
    background: rgba(63,169,245,0.2);
    color: white;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn { color: rgba(255,255,255,0.6) !important; border-radius: var(--border-radius-sm) !important; }
.logout-btn:hover { background: rgba(230,57,70,0.2) !important; color: #ff6b7a !important; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */

.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
    height: var(--navbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-left { display: flex; align-items: center; gap: 14px; }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--gray-600); cursor: pointer; padding: 6px; border-radius: 8px; }
.menu-toggle:hover { background: var(--gray-100); }
.page-title { font-size: 17px; font-weight: 600; color: var(--gray-800); }

.navbar-right { display: flex; align-items: center; gap: 8px; position: relative; }
.navbar-action {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100); color: var(--gray-600);
    cursor: pointer; font-size: 16px; transition: var(--transition);
    position: relative;
}
.navbar-action:hover { background: var(--gray-200); color: var(--primary); }
.badge-dot { position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; background: var(--danger); border-radius: 50%; font-size: 9px; color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; border: 2px solid white; }

.navbar-divider { width: 1px; height: 28px; background: var(--gray-200); margin: 0 4px; }
.user-menu { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 10px; cursor: pointer; }
.user-menu:hover { background: var(--gray-100); }
.user-avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: white; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.user-name-sm { font-size: 13px; font-weight: 500; color: var(--gray-700); }

/* Alert Panel */
.alert-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 50px;
    width: 320px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    z-index: 200;
    display: none;
}
.alert-panel.show { display: block; }
.alert-panel-header { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.alert-panel-header h4 { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.badge-count { background: var(--danger); color: white; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.alert-panel-body { max-height: 280px; overflow-y: auto; }
.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--gray-50); }
.alert-item i { margin-top: 2px; }
.alert-item.alert-danger i { color: var(--danger); }
.alert-item.alert-warning i { color: var(--warning); }
.alert-item div { display: flex; flex-direction: column; }
.alert-item strong { font-size: 13px; color: var(--gray-800); }
.alert-item small { font-size: 11px; color: var(--gray-500); }
.alert-empty { padding: 24px; text-align: center; color: var(--gray-400); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.alert-empty i { font-size: 24px; color: var(--success); }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */

.flash-message {
    margin: 16px 24px 0;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    display: flex; align-items: center; gap: 10px;
    font-size: 13.5px; font-weight: 500;
    transition: opacity 0.5s ease;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.flash-message button { margin-left: auto; background: none; border: none; cursor: pointer; opacity: 0.6; font-size: 13px; }
.flash-message button:hover { opacity: 1; }

/* ============================================================
   CONTENT AREA
   ============================================================ */

.content { padding: 24px; flex: 1; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
}

.card-header h3 { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 20px; }

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex; align-items: flex-start; gap: 14px;
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}

.stat-icon.blue { background: rgba(63,169,245,0.15); color: var(--accent); }
.stat-icon.green { background: rgba(42,157,143,0.15); color: var(--success); }
.stat-icon.yellow { background: rgba(255,183,3,0.15); color: var(--warning); }
.stat-icon.red { background: rgba(230,57,70,0.15); color: var(--danger); }
.stat-icon.dark { background: rgba(13,59,102,0.12); color: var(--primary); }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--gray-800); line-height: 1.2; margin: 2px 0; }
.stat-sub { font-size: 11px; color: var(--gray-400); }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrapper { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    padding: 11px 14px;
    text-align: left;
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-primary { background: rgba(13,59,102,0.12); color: var(--primary); }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: none; border-radius: var(--border-radius-sm);
    font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-light); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #238276; }

.btn-warning { background: var(--warning); color: var(--gray-800); }
.btn-warning:hover { background: #e6a400; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c4303d; }

.btn-outline { background: transparent; border: 1.5px solid var(--gray-300); color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); }

.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    color: var(--gray-800);
    background: white;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(63,169,245,0.12);
}

.form-control::placeholder { color: var(--gray-400); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M2 5l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; padding-right: 32px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.input-group { position: relative; }
.input-group-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 13px; }
.input-group .form-control { padding-left: 32px; }

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.modal-overlay.show { display: flex; }

.modal {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 540px;
    animation: modalIn 0.2s ease;
    margin: auto;
}

.modal-lg { max-width: 720px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.modal-close { background: none; border: none; font-size: 20px; color: var(--gray-400); cursor: pointer; width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

.search-box {
    position: relative;
    width: 260px;
}

.search-box i {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400); font-size: 13px;
}

.search-box input {
    padding-left: 32px;
    width: 100%;
}

/* ============================================================
   CHARTS
   ============================================================ */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.chart-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.chart-title { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 16px; }
.chart-container { position: relative; height: 220px; }

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
    display: flex; align-items: center; gap: 6px;
    padding: 16px 0 0;
    justify-content: center;
}

.page-btn {
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    background: white; color: var(--gray-600);
    font-size: 13px; cursor: pointer;
    text-decoration: none; transition: var(--transition);
    padding: 0 8px;
}

.page-btn:hover { background: var(--gray-100); border-color: var(--gray-300); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state i { font-size: 40px; margin-bottom: 12px; }
.empty-state h4 { font-size: 16px; color: var(--gray-600); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ============================================================
   BREADCRUMB
   ============================================================ */

.breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: var(--gray-400);
    margin-bottom: 20px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--gray-500); }

/* ============================================================
   SIDEBAR OVERLAY
   ============================================================ */

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ============================================================
   PROFILE / UTILITY
   ============================================================ */

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-400); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.divider { height: 1px; background: var(--gray-100); margin: 16px 0; }

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

@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-overlay.show { display: block; }
    .sidebar-close { display: flex; }
    .main-wrapper { margin-left: 0; }
    .menu-toggle { display: flex; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { width: 100%; }
    .user-name-sm { display: none; }
    .table th, .table td { padding: 10px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .modal { max-width: 100%; margin: 0; border-radius: 0; }
    .modal-overlay { padding: 0; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%; max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    padding: 32px 32px 24px;
    text-align: center;
}

.login-logo {
    width: 60px; height: 60px;
    background: var(--accent);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: white;
    margin: 0 auto 12px;
}

.login-header h1 { color: white; font-size: 22px; font-weight: 700; }
.login-header p { color: rgba(255,255,255,0.6); font-size: 13px; margin-top: 4px; }
.login-body { padding: 28px 32px 32px; }
.login-body .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* ============================================================
   REPORT STYLES
   ============================================================ */

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.report-stat {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    padding: 14px 16px;
}

.report-stat label { display: block; font-size: 11px; color: var(--gray-400); font-weight: 600; text-transform: uppercase; }
.report-stat .value { font-size: 18px; font-weight: 700; color: var(--gray-800); margin-top: 2px; }

.print-btn { display: none; }
@media print {
    .sidebar, .navbar, .toolbar, .btn, .flash-message, .print-hide { display: none !important; }
    .main-wrapper { margin-left: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .print-btn { display: inline-flex; }
}

/* ============================================================
   v2.0 IMPROVEMENTS — Hover, Spacing, Animations
   ============================================================ */

/* Smoother nav hover */
.nav-item {
    border-radius: 8px !important;
    margin: 2px 8px !important;
    padding: 10px 14px !important;
}
.nav-item:hover {
    background: rgba(255,255,255,0.12) !important;
    /* removed translateX — was causing sidebar jitter */
}
.nav-item.active { border-radius: 8px !important; }

/* Stat card hover lift */
.stat-card {
    cursor: default;
    transition: transform 0.22s ease, box-shadow 0.22s ease !important;
}
.stat-card:hover {
    box-shadow: 0 8px 24px rgba(13,59,102,0.16) !important;
    /* no transform — prevents layout jump */
}

/* Table row hover */
.table tbody tr {
    transition: background 0.15s ease;
}
.table tbody tr:hover { background: #f0f7ff !important; }

/* Button hover improvements */
.btn { transition: all 0.18s ease !important; }
.btn:hover:not(:disabled) { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn:active:not(:disabled) { transform: translateY(0); }

/* Badge pulse for danger */
.badge-danger { animation: none; }
.badge-dot { animation: pulse 2s infinite; }
@keyframes pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(230,57,70,0.4); }
    50%      { box-shadow: 0 0 0 5px rgba(230,57,70,0); }
}

/* Card hover */
.card { transition: box-shadow 0.2s ease; }
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

/* Alert panel items hover */
.alert-item { transition: background 0.15s ease; cursor: default; }
.alert-item:hover { background: var(--gray-50); }

/* Modal animation */
@keyframes modalIn {
    from { opacity:0; transform: translateY(-16px) scale(0.98); }
    to   { opacity:1; transform: translateY(0)     scale(1);    }
}

/* Form control focus glow */
.form-control:focus {
    box-shadow: 0 0 0 3px rgba(63,169,245,0.18) !important;
}

/* Low stock alert banner */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 4px solid;
}
.alert-banner-danger  { background:#fee2e2; color:#991b1b; border-color:var(--danger); }
.alert-banner-warning { background:#fef3c7; color:#92400e; border-color:var(--warning); }
.alert-banner-success { background:#d1fae5; color:#065f46; border-color:var(--success); }
.alert-banner-info    { background:#dbeafe; color:#1e40af; border-color:var(--accent); }

/* Supplier / Unit tag */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Import/Export toolbar */
.import-box {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    background: var(--gray-50);
    transition: all 0.2s;
    cursor: pointer;
}
.import-box:hover { border-color: var(--accent); background: rgba(63,169,245,0.04); }
.import-box i { font-size: 32px; color: var(--gray-300); margin-bottom: 8px; display: block; }

/* Progress bar */
.progress-bar-wrap { background:var(--gray-200); border-radius:4px; height:8px; overflow:hidden; }
.progress-bar { height:100%; border-radius:4px; transition: width 0.4s ease; }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%; transform: translateX(-50%);
    background: var(--gray-800); color: white;
    font-size: 11px; padding: 4px 10px; border-radius: 6px;
    white-space: nowrap; z-index: 999; pointer-events: none;
}

/* Scrollbar style */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Responsive improvements */
@media (max-width: 768px) {
    .nav-item { margin: 1px 6px !important; }
    .stat-value { font-size: 18px !important; }
}

/* ============================================================
   MOBILE RESPONSIVE — Complete v3.0
   ============================================================ */

/* Dashboard bottom grid */
.dash-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

/* ── TABLET (max 1024px) ─────────────────────────────────── */
@media (max-width: 1024px) {
    .charts-grid        { grid-template-columns: 1fr; }
    .dash-bottom-grid   { grid-template-columns: 1fr; }
    .stats-grid         { grid-template-columns: repeat(3,1fr); }
}

/* ── MOBILE (max 768px) ──────────────────────────────────── */
@media (max-width: 768px) {

    /* Sidebar */
    .sidebar {
        left: calc(-1 * var(--sidebar-width)) !important;
        z-index: 1100;
    }
    .sidebar.open { left: 0 !important; }
    .sidebar-overlay.show { display: block; }
    .sidebar-close { display: flex !important; }
    .main-wrapper  { margin-left: 0 !important; }
    .menu-toggle   { display: flex !important; }

    /* Navbar */
    .navbar { padding: 0 14px; }
    .page-title { font-size: 15px; }
    .user-name-sm { display: none; }
    .navbar-divider { display: none; }

    /* Content */
    .content { padding: 12px; }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card  { padding: 14px 12px; gap: 10px; }
    .stat-icon  { width: 40px; height: 40px; font-size: 16px; }
    .stat-value { font-size: 18px !important; }
    .stat-label { font-size: 11px; }
    .stat-sub   { font-size: 10px; }

    /* Charts */
    .charts-grid  { grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
    .chart-container { height: 180px; }
    .chart-card   { padding: 14px; }
    .chart-title  { font-size: 13px; }

    /* Dashboard bottom */
    .dash-bottom-grid { grid-template-columns: 1fr; gap: 12px; }

    /* Cards */
    .card-header  { padding: 12px 14px; }
    .card-header h3 { font-size: 13.5px; }
    .card-body    { padding: 14px; }

    /* Tables */
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table th, .table td { padding: 9px 10px; font-size: 12.5px; }
    .table th { font-size: 11px; }

    /* Toolbar */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .toolbar-left, .toolbar-right {
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }
    .toolbar-right { justify-content: flex-end; }
    .search-box { width: 100%; }
    .search-box input { width: 100%; }

    /* Forms */
    .form-row        { grid-template-columns: 1fr !important; gap: 0; }
    .form-row.cols-3 { grid-template-columns: 1fr !important; }
    .form-label      { font-size: 12.5px; }
    .form-control    { font-size: 13px; padding: 8px 10px; }

    /* Modals */
    .modal-overlay { padding: 10px; align-items: flex-end; }
    .modal {
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
        overflow-y: auto;
    }
    .modal-body   { padding: 16px; }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .modal-footer .btn { flex: 1; justify-content: center; }

    /* Buttons */
    .btn { padding: 7px 12px; font-size: 12.5px; }
    .btn-lg { padding: 10px 18px; font-size: 14px; }
    .btn-sm { padding: 5px 9px; font-size: 11.5px; }

    /* Badges */
    .badge { font-size: 10.5px; padding: 2px 8px; }

    /* Pagination */
    .pagination { gap: 4px; }
    .page-btn { min-width: 30px; height: 30px; font-size: 12px; }

    /* Breadcrumb */
    .breadcrumb { font-size: 11.5px; margin-bottom: 12px; }

    /* Flash messages */
    .flash-message { margin: 10px 0 0; font-size: 12.5px; padding: 10px 12px; }

    /* Alert banner */
    .alert-banner { font-size: 12.5px; padding: 10px 14px; }

    /* Report summary */
    .report-summary { grid-template-columns: repeat(2,1fr); }

    /* Stats grid in report */
    .report-stat .value { font-size: 15px; }

    /* Profile */
    .dash-bottom-grid > div { min-width: 0; }

    /* Login page */
    .login-page { padding: 12px; align-items: flex-start; padding-top: 30px; }
    .login-card { max-width: 100%; }
    .login-body { padding: 20px 18px 24px; }
    .login-header { padding: 24px 18px 18px; }
    .login-logo { width: 50px; height: 50px; font-size: 22px; }
    .login-header h1 { font-size: 18px; }

    /* Sidebar user info */
    .sidebar-user { padding: 12px 14px; }
    .sidebar-brand { padding: 14px 12px; }
    .brand-name { font-size: 14px; }

    /* Hide some table columns on mobile */
    .hide-mobile { display: none !important; }
}

/* ── SMALL MOBILE (max 480px) ────────────────────────────── */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card  { padding: 12px 10px; }
    .stat-value { font-size: 16px !important; }

    .content { padding: 10px; }

    /* Stack action buttons */
    .toolbar-right { justify-content: stretch; }
    .toolbar-right .btn { flex: 1; justify-content: center; }

    /* Report summary 1 col */
    .report-summary { grid-template-columns: 1fr 1fr; }

    /* Nav items smaller */
    .nav-item { padding: 9px 12px !important; font-size: 13px; }
    .nav-label { font-size: 9.5px; }
}

/* ── TOUCH FRIENDLY ──────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
    .btn        { min-height: 40px; }
    .nav-item   { min-height: 44px; }
    .form-control { min-height: 42px; font-size: 16px !important; } /* prevent zoom on iOS */
    .page-btn   { min-width: 36px; height: 36px; }
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
    .sidebar,.navbar,.toolbar,.btn,.flash-message,
    .sidebar-overlay,.menu-toggle { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd; }
    .charts-grid { display: none; }
}
