/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f6f8fc;
    --sidebar-bg: #1e3a5f;
    --sidebar-text: #b8c7da;
    --sidebar-active: #f2c94c;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e6edf5;
    --primary: #2d5b8a;
    --primary-hover: #23486d;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(15, 23, 42, .06);
    --sidebar-w: 220px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

/* ===== Login Page ===== */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--sidebar-bg);
}
.login-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 40px; width: 100%; max-width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,.2); text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w); background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 100;
}
.sidebar-header {
    padding: 20px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header h2 { color: #fff; font-size: 20px; letter-spacing: 1px; }
.sidebar-subtitle { color: var(--sidebar-text); font-size: 11px; }

.nav-links { list-style: none; padding: 12px 0; flex: 1; }
.nav-links li a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; color: var(--sidebar-text);
    font-size: 14px; transition: all .15s;
}
.nav-links li a:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav-links li.active a {
    color: #003087; background: var(--sidebar-active);
    font-weight: 700;
    border-radius: 0;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }

/* ===== Content ===== */
.content { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
    background: #1e3a5f;
    color: #fff;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.topbar h1 { color: #fff; }
.topbar h1 { font-size: 20px; font-weight: 600; }
.page-content { padding: 24px; }

/* ===== Flash Messages ===== */
.flash-container { padding: 16px 24px 0; }
.flash {
    padding: 10px 16px; border-radius: var(--radius); margin-bottom: 8px;
    font-size: 14px; display: flex; align-items: center; justify-content: space-between;
}
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-close {
    background: none; border: none; font-size: 18px;
    cursor: pointer; color: inherit; padding: 0 4px;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-value.stat-time { font-size: 13px; color: var(--text); font-weight: 500; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== Section Header ===== */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.section-header h2 { font-size: 18px; }

/* ===== Card ===== */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.card h3 { font-size: 16px; margin-bottom: 16px; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    background: #f8fafc; padding: 10px 12px;
    text-align: left; font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr.row-not-found { opacity: .55; }

/* Product cell */
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.product-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.product-thumb-lg { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.product-title { font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-id { font-size: 11px; color: var(--text-muted); }
.no-image {
    width: 56px; height: 56px; background: var(--border);
    border-radius: 4px; display: flex; align-items: center;
    justify-content: center; font-size: 10px; color: var(--text-muted);
}

/* Trend indicators */
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }
.trend-same { color: var(--text-muted); }

/* Badges */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600;
}
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.form-input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 14px; color: var(--text);
    background: #fff; transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-input-sm { max-width: 260px; min-width: 220px; }
.form-input-xs { width: 70px; padding: 4px 8px; font-size: 13px; display: inline-block; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.inline-form .form-group { margin-bottom: 0; }
.inline-form-compact { display: flex; align-items: center; gap: 6px; }

.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; }

.filter-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-form .form-group { min-width: 140px; flex: 1; }

select.form-input { appearance: auto; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 16px; border: none; border-radius: 6px;
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: #f2c94c; color: #2a2a2a; font-weight: 700; }
.btn-primary:hover { background: #e7bd3f; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-outline {
    background: transparent; border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===== Pagination ===== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 16px;
}
.page-info { font-size: 13px; color: var(--text-muted); }

/* ===== Misc ===== */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.result-count { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--text-muted);
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
code {
    background: #f1f5f9; padding: 2px 6px; border-radius: 4px;
    font-size: 12px; color: var(--text);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header h2 { font-size: 14px; }
    .sidebar-subtitle, .nav-links li a span:not(.nav-icon) { display: none; }
    .nav-links li a { justify-content: center; padding: 12px; }
    .nav-icon { margin: 0; }
    .content { margin-left: 60px; }
    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-form { flex-direction: column; }
    .inline-form { flex-direction: column; align-items: stretch; }
}

/* ===== Aesthetic v2: Editorial-Tech Walmart blend ===== */
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;800&family=JetBrains+Mono:wght@400;700&display=swap");

:root {
  --bg-layer-1: #f7f9fc;
  --bg-layer-2: #edf2fa;
  --ink-strong: #13263f;
  --ink-soft: #5f7287;
  --nav-blue: #1e3a5f;
  --brand-blue: #2b5c8e;
  --brand-yellow: #f2c94c;
}

body {
  font-family: "JetBrains Mono", monospace;
  background:
    radial-gradient(1200px 500px at 120% -10%, rgba(43,92,142,.14), transparent 60%),
    radial-gradient(900px 350px at -10% 110%, rgba(242,201,76,.14), transparent 60%),
    linear-gradient(135deg, var(--bg-layer-1), var(--bg-layer-2));
  color: var(--ink-strong);
}

.topbar h1,
.section-header h2,
.card h3,
.login-card h1 {
  font-family: "Playfair Display", serif;
  letter-spacing: .2px;
}

.sidebar {
  background: linear-gradient(180deg, #1e3a5f 0%, #1a3453 100%);
  box-shadow: 8px 0 30px rgba(20,35,55,.12);
}

.topbar {
  background: linear-gradient(90deg, #1e3a5f 0%, #214569 55%, #2b5c8e 100%);
}

.card, .table-wrapper, .stat-card {
  border: 1px solid rgba(30,58,95,.08);
  box-shadow: 0 10px 24px rgba(20,35,55,.06);
  backdrop-filter: blur(2px);
}

.btn-primary {
  background: linear-gradient(180deg, #f4d469 0%, #f2c94c 100%);
  border: 1px solid rgba(153,121,28,.35);
}

/* one orchestrated page reveal */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-content > * {
  opacity: 0;
  animation: revealUp .45s ease forwards;
}
.page-content > *:nth-child(1) { animation-delay: .03s; }
.page-content > *:nth-child(2) { animation-delay: .08s; }
.page-content > *:nth-child(3) { animation-delay: .13s; }
.page-content > *:nth-child(4) { animation-delay: .18s; }
.page-content > *:nth-child(5) { animation-delay: .23s; }
