/* Product Lookup - Admin Panel styles */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #e2e6ee;
    --text: #1c2333;
    --muted: #6b7488;
    --brand: #1f5eff;
    --brand-dark: #1a4fd6;
    --danger: #d93636;
    --danger-dark: #b82b2b;
    --success: #1a8d5f;
    --warning: #b57d10;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 28, 45, .06), 0 4px 16px rgba(20, 28, 45, .05);
    --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- layout */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: #131a2b;
    color: #c8cede;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .5px;
}

.brand-text {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

.nav {
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-link {
    padding: 9px 12px;
    border-radius: 8px;
    color: #c8cede;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
    text-decoration: none;
}

.nav-link.is-active {
    background: var(--brand);
    color: #fff;
}

.sidebar-foot {
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.who-name { color: #fff; font-weight: 600; font-size: 13px; }
.who-role { color: #7d879e; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.who-link {
    display: inline-block;
    margin-top: 4px;
    color: #9aa5bd;
    font-size: 12px;
    text-decoration: none;
}
.who-link:hover, .who-link.is-active { color: #fff; text-decoration: underline; }

.content {
    flex: 1;
    min-width: 0;
    padding: 22px 26px 48px;
}

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

.topbar h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
}

.topbar-actions { display: flex; gap: 8px; }

/* ----------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-body { padding: 18px; }

.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
    line-height: 1.1;
}

/* ---------------------------------------------------------------- tables */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 13.5px;
}

table.data th,
table.data td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data thead th {
    background: #f8f9fc;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

table.data tbody tr:hover { background: #fafbfe; }
table.data tbody tr:last-child td { border-bottom: none; }

.col-actions { text-align: right; white-space: nowrap; }
.col-num { text-align: right; }

.thumb {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #f1f3f8;
    display: block;
}

.thumb-empty {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    border: 1px dashed var(--border);
    display: grid;
    place-items: center;
    color: #b3bacb;
    font-size: 10px;
}

.empty {
    padding: 42px 18px;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
}

/* --------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
}

.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: #f1f3f8; color: var(--text); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); }

.btn-ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, .18);
    color: #c8cede;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.inline-form { display: inline; }

/* ----------------------------------------------------------------- forms */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }

.field label {
    font-weight: 600;
    font-size: 13px;
}

.field .hint {
    color: var(--muted);
    font-size: 12px;
}

input[type=text],
input[type=password],
input[type=number],
input[type=search],
input[type=file],
select,
textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(31, 94, 255, .13);
}

textarea { resize: vertical; min-height: 96px; }

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* filter bar */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.filters .field { min-width: 160px; flex: 1 1 160px; }
.filters .field-search { flex: 2 1 260px; }
.filters .filter-actions { display: flex; gap: 8px; }

/*
 * A note under the whole filter bar, not inside one field.
 * Putting help text inside a .field makes that field taller, and because the
 * bar bottom-aligns its items the taller field's input rides up out of line
 * with the rest. Its own full-width row keeps every input on one line.
 */
.filters .filters-note {
    flex: 1 0 100%;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.filters .filters-note code {
    background: #eef1f7;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11.5px;
}

/*
 * Belt and braces: should a .hint ever be added inside a filter field again,
 * take it out of the flow so it cannot change that field's height and repeat
 * the misalignment.
 */
.filters .field { position: relative; }

.filters .field > .hint {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    white-space: nowrap;
}

/* ---------------------------------------------------------------- alerts */

.alert {
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    border: 1px solid transparent;
    font-size: 13.5px;
}

.alert-success { background: #e7f6ef; border-color: #b9e5cf; color: #146b48; }
.alert-error   { background: #fdeaea; border-color: #f5c2c2; color: #a52424; }
.alert-info    { background: #e9f0ff; border-color: #c3d5ff; color: #1a4fd6; }
.alert-warning { background: #fdf3dd; border-color: #f0dda6; color: var(--warning); }

.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- badges */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: #eef1f7;
    color: #5b6479;
}

.badge-active   { background: #e7f6ef; color: #146b48; }
.badge-inactive { background: #fdeaea; color: #a52424; }

.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ------------------------------------------------------------ pagination */

.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 14px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 6px 11px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 13px;
    color: var(--text);
}

.pagination a:hover { background: #f1f3f8; text-decoration: none; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled { color: #b3bacb; }

/* ------------------------------------------------------------ login page */

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(160deg, #131a2b 0%, #24304f 100%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 14px;
    padding: 30px 28px;
    box-shadow: 0 18px 50px rgba(10, 16, 32, .35);
}

.login-card h1 {
    margin: 0 0 4px;
    font-size: 20px;
}

.login-card .sub {
    color: var(--muted);
    margin: 0 0 22px;
    font-size: 13.5px;
}

.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 820px) {
    .layout { flex-direction: column; }

    .sidebar {
        width: 100%;
        flex: none;
        height: auto;
        position: static;
    }

    .nav { flex-direction: row; overflow-x: auto; padding: 10px; }
    .nav-link { white-space: nowrap; }
    .content { padding: 16px 14px 40px; }
}
