@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary:    #2563eb;
    --primary-dk: #1d4ed8;
    --success:    #16a34a;
    --warning:    #d97706;
    --danger:     #dc2626;
    --info:       #0891b2;
    --bg:         #f8fafc;
    --surface:    #ffffff;
    --border:     #e2e8f0;
    --text:       #1e293b;
    --muted:      #64748b;
    --nav-bg:     #1e293b;
    --radius:     10px;
    --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

/* ── Navbar ─────────────────────────────────── */
.navbar {
    background: var(--nav-bg);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.nav-brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 1rem 0;
    white-space: nowrap;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.nav-links li a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    padding: 1.1rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color .2s, background .2s;
}

.nav-links li a:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
}

/* ── Container ──────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* ── Page Header ────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ── Dashboard Stats ────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform .2s, box-shadow .2s;
}

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

.stat-icon { font-size: 2rem; margin-bottom: .5rem; }
.stat-number { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: .25rem; font-weight: 500; }

.stat-blue   { border-top: 4px solid var(--primary); }
.stat-amber  { border-top: 4px solid var(--warning); }
.stat-red    { border-top: 4px solid var(--danger); }
.stat-green  { border-top: 4px solid var(--success); }

.stat-blue   .stat-number { color: var(--primary); }
.stat-amber  .stat-number { color: var(--warning); }
.stat-red    .stat-number { color: var(--danger); }
.stat-green  .stat-number { color: var(--success); }

/* ── Quick Actions ──────────────────────────── */
.quick-actions { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.quick-actions h2 { margin-bottom: 1rem; font-size: 1.1rem; }
.action-grid { display: flex; gap: 1rem; flex-wrap: wrap; }
.action-btn { padding: .625rem 1.25rem; border-radius: var(--radius); font-weight: 600; font-size: .875rem; text-decoration: none; transition: all .2s; }

/* ── Buttons ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-edit   { background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe; }
.btn-edit:hover { background: #dbeafe; }
.btn-delete { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-delete:hover { background: #fee2e2; }

/* ── Alerts ─────────────────────────────────── */
.alert {
    padding: .875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-weight: 500;
    font-size: .9rem;
}
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Table ──────────────────────────────────── */
.table-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table { width: 100%; border-collapse: collapse; }

.data-table thead th {
    background: #f1f5f9;
    padding: .875rem 1rem;
    text-align: left;
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td {
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }

/* Row status highlighting */
.row-expired  { background: #fff5f5 !important; }
.row-warning  { background: #fffbeb !important; }
.row-lowstock { background: #fffbeb !important; }

/* ── Tags / Badges ──────────────────────────── */
.tag {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.tag-green  { background: #dcfce7; color: #166534; }
.tag-amber  { background: #fef9c3; color: #854d0e; }
.tag-red    { background: #fee2e2; color: #991b1b; }
.tag-blue   { background: #dbeafe; color: #1e40af; }

.badge-category {
    background: #e0e7ff;
    color: #3730a3;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
}

.qty-critical { color: var(--danger); font-weight: 700; font-size: 1.1rem; }
.text-muted   { color: var(--muted); }
.empty-msg    { text-align: center; color: var(--muted); padding: 2rem; font-style: italic; }
.actions      { white-space: nowrap; }

/* ── Form Card ──────────────────────────────── */
.form-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 900px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group-full { grid-column: 1 / -1; }

label {
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
}

.form-control {
    padding: .6rem .9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

textarea.form-control { resize: vertical; }

.error-msg { color: var(--danger); font-size: .8rem; }

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    align-items: center;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .navbar { flex-direction: column; padding: .75rem 1rem; gap: .5rem; }
    .nav-links { justify-content: center; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .container { padding: 0 1rem; margin: 1rem auto; }
    .data-table { font-size: .8rem; }
    .form-card { padding: 1.25rem; }
}