/* ============================================================
   SRI SPS E-BIKES — ADMIN PANEL
   Fresh premium dashboard design system (v2)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:root {
    --primary: #0F9D74;
    --primary-dark: #0B7C5C;
    --primary-light: #E3F7EE;
    --ink: #0B1220;
    --sidebar: #0D1526;
    --sidebar-hover: #16233B;
    --text: #1A2332;
    --text-muted: #64748B;
    --bg: #F5F7F8;
    --card: #FFFFFF;
    --border: #E7EBEE;
    --danger: #E5484D;
    --danger-light: #FDEBEC;
    --warning: #F5A524;
    --warning-light: #FEF3DD;
    --success-light: #E3F7EE;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.05), 0 1px 3px rgba(15,23,42,0.04);
    --shadow-md: 0 8px 24px rgba(15,23,42,0.08);
    --shadow-lg: 0 24px 60px rgba(15,23,42,0.18);
    --focus-ring: 0 0 0 4px rgba(15, 157, 116, 0.14);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --t-fast: 0.18s var(--ease);
    --t-med: 0.3s var(--ease);
    --font-head: 'Outfit', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
}

body { font-family: var(--font-body); background: var(--bg); color: var(--text); overflow-x: hidden; }
h1,h2,h3,h4 { font-family: var(--font-head); color: var(--ink); letter-spacing: -0.01em; }
::selection { background: var(--primary); color: #fff; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes cardIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes badgePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0.35); } 50% { box-shadow: 0 0 0 4px rgba(229,72,77,0); } }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; background: var(--card); }
.login-split { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }

.login-brand-panel {
    position: relative; overflow: hidden; background: linear-gradient(155deg, #0B1220 0%, #0F2A22 55%, #0B1220 100%);
    display: flex; align-items: center; padding: 60px; isolation: isolate;
}
.login-brand-blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5; z-index: -1; }
.login-blob-1 { width: 420px; height: 420px; background: radial-gradient(circle, #0F9D74 0%, transparent 70%); top: -120px; left: -100px; }
.login-blob-2 { width: 380px; height: 380px; background: radial-gradient(circle, #16324F 0%, transparent 70%); bottom: -140px; right: -80px; }
.login-brand-content { max-width: 460px; animation: fadeInUp 0.6s var(--ease); }
.login-brand-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 56px; }
.login-brand-logo img { height: 34px; }
.login-brand-logo span { color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: 0.03em; }
.login-brand-logo span em { color: #4ADE9A; font-style: normal; }
.login-brand-content h1 { color: #fff; font-size: 38px; line-height: 1.2; margin-bottom: 18px; }
.login-brand-content p { color: rgba(255,255,255,0.6); font-size: 15px; line-height: 1.7; margin-bottom: 44px; max-width: 380px; }
.login-brand-stats { display: flex; gap: 28px; padding-top: 28px; border-top: 1px solid rgba(255,255,255,0.1); }
.login-brand-stats div { display: flex; flex-direction: column; gap: 4px; }
.login-brand-stats strong { color: #fff; font-family: var(--font-head); font-size: 15px; }
.login-brand-stats span { color: rgba(255,255,255,0.45); font-size: 12px; }

.login-form-panel { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-container { width: 100%; max-width: 380px; }
.login-card { background: var(--card); border-radius: var(--radius-lg); padding: 8px 4px; animation: fadeInUp 0.5s var(--ease); }
.login-header { margin-bottom: 32px; }
.login-header h1 { font-size: 28px; }
.login-header p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
@media (max-width: 900px) {
    .login-split { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
}
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; }
.login-form input {
    width: 100%; padding: 13px 16px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: 14px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.login-form input.input-error { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(229,72,77,0.1); }
.password-input { position: relative; }
.password-input input { padding-right: 44px; }
.toggle-password { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; min-height: 44px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; border: none; transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(15,157,116,0.22); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15,157,116,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; transform: translateY(-1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 12.5px; min-height: 38px; }
.back-link { display: block; text-align: center; margin-top: 22px; color: var(--text-muted); font-size: 13px; }
.back-link:hover { color: var(--primary); }

/* ---------- Dashboard layout ---------- */
.dashboard-body { background: var(--bg); }
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 264px; background: var(--sidebar); color: #fff; flex-shrink: 0;
    display: flex; flex-direction: column; transition: width 0.25s ease; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar.collapsed { width: 84px; }
.sidebar.collapsed .sidebar-brand span, .sidebar.collapsed .nav-link span, .sidebar.collapsed .nav-group-label { display: none; }
.sidebar { position: relative; }
.sidebar::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), #4ADE9A, var(--primary)); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand img { height: 32px; }
.sidebar-brand span { font-family: var(--font-head); font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.sidebar-toggle { margin-left: auto; background: rgba(255,255,255,0.06); border: none; color: #fff; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.35); padding: 16px 12px 8px; font-weight: 700; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
    color: rgba(255,255,255,0.68); font-size: 14px; font-weight: 500; margin-bottom: 2px; position: relative;
    transition: background var(--t-fast), color var(--t-fast), padding-left var(--t-fast);
}
.nav-link i { width: 18px; text-align: center; font-size: 15px; transition: transform var(--t-fast); }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; padding-left: 18px; }
.nav-link:hover i { transform: scale(1.1); }
.nav-link.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(15,157,116,0.35); }
.nav-link.active i { color: #fff; }
.nav-badge {
    margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
    padding: 2px 7px; border-radius: 999px; min-width: 18px; text-align: center; animation: badgePulse 2s infinite;
}
.nav-link.active .nav-badge { background: rgba(255,255,255,0.25); animation: none; }

.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-profile { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; margin-bottom: 4px; }
.sidebar-profile-avatar {
    width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), #4ADE9A);
    color: #0B1220; font-family: var(--font-head); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-profile-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-profile-info strong { color: #fff; font-size: 13px; }
.sidebar-profile-info span { color: rgba(255,255,255,0.4); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar.collapsed .sidebar-profile-info, .sidebar.collapsed .logout-link span { display: none; }
.logout-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: rgba(255,255,255,0.6); font-size: 14px; transition: background var(--t-fast), color var(--t-fast); }
.logout-link:hover { background: rgba(229,72,77,0.15); color: #ff8a8d; }

.main-content { flex: 1; min-width: 0; }
.main-content.expanded { }
.topbar {
    display: flex; align-items: center; justify-content: space-between; padding: 18px 32px;
    background: rgba(255,255,255,0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.topbar-titles { flex: 1; min-width: 0; }
.topbar h2 { font-size: 20px; line-height: 1.3; }
.topbar-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.topbar-user-avatar {
    width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--ink), var(--sidebar-hover));
    color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--primary-light);
}
.mobile-menu-btn { display: none; background: var(--bg); border: none; width: 44px; height: 44px; border-radius: 10px; align-items: center; justify-content: center; flex-shrink: 0; }

.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(11,18,32,0.55); backdrop-filter: blur(2px);
    z-index: 890; display: none; opacity: 0; transition: opacity var(--t-med);
}
.sidebar-overlay.active { display: block; opacity: 1; }

.content-area { padding: 28px 32px 60px; }
.content-section { display: none; }
.content-section.active { display: block; animation: fadeInUp 0.35s var(--ease); }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card {
    position: relative; overflow: hidden; background: var(--card); border-radius: var(--radius-md); padding: 22px 20px 20px; border: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), #4ADE9A); transform: scaleX(0); transform-origin: left; transition: transform var(--t-med); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.stat-card:hover::before { transform: scaleX(1); }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--primary-light), #fff); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; transition: transform var(--t-fast); box-shadow: inset 0 0 0 1px rgba(15,157,116,0.12); }
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
.stat-icon.warn { background: linear-gradient(135deg, var(--warning-light), #fff); color: var(--warning); box-shadow: inset 0 0 0 1px rgba(245,165,36,0.15); }
.stat-icon.danger { background: linear-gradient(135deg, var(--danger-light), #fff); color: var(--danger); box-shadow: inset 0 0 0 1px rgba(229,72,77,0.15); }
.stat-info h3 { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-info p { font-size: 12px; color: var(--text-muted); margin-top: 1px; font-weight: 500; }

.panel { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 24px; margin-bottom: 24px; animation: cardIn 0.4s var(--ease); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-head h3 { font-size: 16px; }
.recent-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px; border-radius: 8px; transition: background var(--t-fast); }
.recent-item:hover { background: var(--bg); }
.recent-item:last-child { border-bottom: none; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---------- Section toolbar ---------- */
.section-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-toolbar h2 { font-size: 20px; }

/* ---------- Tabs (Products: Bikes / Batteries) ---------- */
.tab-row { display: flex; gap: 8px; margin-bottom: 20px; background: var(--bg); padding: 5px; border-radius: 12px; width: fit-content; }
.tab-btn { padding: 9px 20px; border-radius: 9px; background: transparent; border: none; font-size: 13.5px; font-weight: 600; color: var(--text-muted); transition: background var(--t-fast), color var(--t-fast); }
.tab-btn.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Tables ---------- */
.table-wrapper { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
thead th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--bg);
    white-space: nowrap;
}
tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: #FAFBFC; }
.action-btns { display: flex; gap: 6px; }
.action-btn { width: 32px; height: 32px; border-radius: 9px; border: none; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast); }
.action-btn:hover { transform: translateY(-1px); }
.action-btn.edit { background: var(--primary-light); color: var(--primary-dark); }
.action-btn.edit:hover { background: var(--primary); color: #fff; }
.action-btn.delete { background: var(--danger-light); color: var(--danger); }
.action-btn.delete:hover { background: var(--danger); color: #fff; }
.action-btn.view { background: var(--bg); color: var(--text-muted); }
.action-btn.view:hover { background: var(--ink); color: #fff; }

.status-pill { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.status-new { background: var(--warning-light); color: var(--warning); }
.status-contacted { background: #E0EEFF; color: #2563EB; }
.status-converted { background: var(--success-light); color: var(--primary-dark); }
.status-closed { background: var(--border); color: var(--text-muted); }
.status-select { border: none; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state .empty-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.empty-state .empty-icon i { font-size: 24px; color: var(--text-muted); margin: 0; display: block; }
.empty-state i { font-size: 34px; color: var(--border); margin-bottom: 12px; display: block; }
.empty-state p { margin-bottom: 14px; font-size: 13.5px; }

/* ---------- Forms ---------- */
.form-section-label {
    display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--primary-dark); margin: 22px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.form-section-label:first-child { margin-top: 0; }
.form-section-label i { font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; }
.form-group label i { color: var(--primary); margin-right: 4px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: 13.5px; background: #fff;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.form-group input.input-error, .form-group select.input-error, .form-group textarea.input-error { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(229,72,77,0.1); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

.upload-box {
    border: 1.5px dashed var(--border); border-radius: var(--radius-md); aspect-ratio: 1/1; width: 100px; height: 100px;
    display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--text-muted); font-size: 22px; flex-shrink: 0;
}
.upload-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(11,18,32,0.55); backdrop-filter: blur(3px); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.active { display: flex; animation: overlayFade 0.2s var(--ease); }
.modal-content { background: var(--card); border-radius: var(--radius-lg); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalPop 0.28s var(--ease); }
.modal-content.modal-sm { max-width: 460px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 2; }
.modal-header h3 { font-size: 17px; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); border: none; font-size: 18px; color: var(--text-muted); transition: background var(--t-fast), color var(--t-fast); }
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-body { padding: 24px 26px; }

/* ---------- Photo crop tool ---------- */
.crop-viewport {
    position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden;
    background: #0B1220; border: 1.5px solid var(--border); touch-action: none; cursor: grab; user-select: none;
}
.crop-viewport:active { cursor: grabbing; }
.crop-viewport img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; pointer-events: none; -webkit-user-drag: none; }
.crop-zoom-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--text-muted); font-size: 13px; }
.crop-zoom-row input[type="range"] { flex: 1; accent-color: var(--primary); }

/* ---------- Color list (bike variants) ---------- */
.color-add-row { display: grid; grid-template-columns: 44px 1fr 1fr; gap: 8px; align-items: end; margin-bottom: 10px; }
.color-add-row input[type=color] { width: 44px; height: 40px; border-radius: 8px; border: 1.5px solid var(--border); padding: 2px; }

/* ---------- Toast ---------- */
/* Same fix as the public site's .toast (css/style.css): translateY(120%) alone
   isn't enough travel to fully clear the bottom:24px gap for a short pill, so a
   sliver of it was always peeking in at the bottom of the admin screen. Hiding
   it with opacity/visibility too makes that independent of the transform math. */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    opacity: 0; visibility: hidden;
    background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
    z-index: 3000; transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s; box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; transition: transform 0.3s ease, opacity 0.3s ease; }
.toast.error { background: var(--danger); }

/* ---------- Theme + storage bar ---------- */
.color-swatch-lg { width: 100%; height: 60px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); }
.storage-bar-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.storage-bar-fill { height: 100%; border-radius: 3px; transition: width var(--t-med), background var(--t-med); }
.status-select { transition: background var(--t-fast); border-radius: 6px; padding: 2px 4px; }
.status-pill { transition: background var(--t-fast); }

/* ============================================================
   RESPONSIVE — breakpoint tiers:
   Mobile Phones 320-480 | Large Phones 481-767
   Tablets 768-1024      | Small Laptops 1025-1366
   Desktops 1367-1920    | Large Screens 1920+

   Sidebar behaviour: Desktop/Small Laptop = fixed, always expanded
   (toggle available). Tablet = same fixed sidebar, collapsible via
   the existing toggle to free up width. Mobile/Large Phone = off-canvas
   drawer behind a hamburger + overlay.
   ============================================================ */

/* ----- Tablets and below (<=1024): 2-col stat cards, stacked dashboard/forms ----- */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .login-header h1 { font-size: 24px; }
}

/* ----- Large Phones + Mobile Phones (<=767): drawer sidebar, compact topbar ----- */
@media (max-width: 767px) {
    .sidebar { position: fixed; left: -280px; top: 0; z-index: 900; box-shadow: var(--shadow-lg); transition: left 0.3s ease; width: 264px !important; }
    .sidebar.active { left: 0; }
    .sidebar-toggle { display: none; }
    .mobile-menu-btn { display: flex; }
    .content-area { padding: 18px 16px 60px; }
    .topbar { padding: 14px 16px; gap: 10px; }
    .topbar h2 { font-size: 17px; }
    .topbar-subtitle { display: none; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 16px 14px 14px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; }
    .stat-info h3 { font-size: 21px; }

    .panel { padding: 18px; }
    .section-toolbar { flex-direction: column; align-items: stretch; }
    .section-toolbar > div { flex-wrap: wrap; }

    .action-btn { width: 38px; height: 38px; }
    .nav-link { padding: 12px 14px; min-height: 44px; }
    .modal-header { padding: 16px 18px; }
    .modal-body { padding: 18px; }
    .upload-box { width: 84px; height: 84px; }
}

/* ----- Mobile Phones only (<=480): single-column everywhere ----- */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-form-panel { padding: 28px 16px; }
    .login-card { padding: 4px; }
    .color-add-row { grid-template-columns: 40px 1fr; }
    .color-add-row > *:nth-child(3) { grid-column: 1 / -1; }
}
