/* HDD RMA Manager — styles */

:root {
    --bg: #0f1115;
    --surface: #1a1d24;
    --surface-2: #222632;
    --border: #2f3443;
    --text: #e6e8ee;
    --muted: #9aa3b2;
    --accent: #4aa3ff;
    --accent-hover: #69b2ff;
    --ok: #3ecf8e;
    --warn: #f2b134;
    --err: #f2555a;
    --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand {
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--text);
}
.topbar nav { display: flex; gap: .25rem; margin-left: 1rem; flex: 1; flex-wrap: wrap; }
.topbar nav a {
    color: var(--muted);
    padding: .4rem .7rem;
    border-radius: var(--radius);
}
.topbar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar nav a.nav-key { background: var(--accent); color: #001; font-weight: 600; }
.topbar nav a.nav-key:hover { background: var(--accent-hover); color: #001; }
.user-menu { display: flex; align-items: center; gap: .5rem; color: var(--muted); }
.user-menu a { color: var(--muted); }

.container {
    max-width: 1200px;
    margin: 1.25rem auto;
    padding: 0 1.25rem;
}

h1, h2, h3 { margin: .5em 0; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; color: var(--muted); margin-top: 1.5rem; }
h3 { font-size: 1rem; }

.muted { color: var(--muted); }
.small { font-size: .85em; }
.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.inline { display: inline; }
.linklike {
    background: none;
    border: 0;
    color: var(--accent);
    padding: 0;
    cursor: pointer;
    font: inherit;
}
.linklike:hover { color: var(--accent-hover); text-decoration: underline; }

.alert {
    padding: .7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert.ok  { background: rgba(62, 207, 142, .1);  border-color: rgba(62, 207, 142, .4); }
.alert.err { background: rgba(242, 85, 90, .1);   border-color: rgba(242, 85, 90, .4); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

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

form .row {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}
form label {
    display: flex;
    flex-direction: column;
    flex: 1 1 160px;
    font-size: .85rem;
    color: var(--muted);
    gap: .25rem;
}
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], select, textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: .5rem .65rem;
    border-radius: var(--radius);
    font: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74, 163, 255, .25);
}
input.scan {
    font-size: 1.15rem;
    padding: .75rem 1rem;
}
input.scan:focus { background: #17212d; }

button, .btn {
    background: var(--accent);
    color: #001;
    border: 0;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; }
button.secondary, .btn.secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 500;
}
button.secondary:hover, .btn.secondary:hover { background: var(--surface); }
button.danger, .btn.danger { background: var(--err); color: #fff; }
button.danger:hover, .btn.danger:hover { background: #ff7a7f; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
th, td {
    padding: .55rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 600;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .02em;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(74,163,255, .04); }

.badge {
    display: inline-block;
    padding: .1rem .55rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.badge.active              { background: rgba(62,207,142,.12); border-color: rgba(62,207,142,.4); color:#9df2c6; }
.badge.failing             { background: rgba(242,177,52,.12); border-color: rgba(242,177,52,.4); color:#f7d58a; }
.badge.awaiting_rma        { background: rgba(74,163,255,.12); border-color: rgba(74,163,255,.4); color:#9ecdff; }
.badge.rma_submitted       { background: rgba(74,163,255,.18); border-color: rgba(74,163,255,.5); color:#bddcff; }
.badge.rma_approved        { background: rgba(62,207,142,.18); border-color: rgba(62,207,142,.5); color:#bef2d6; }
.badge.rma_shipped_to_vendor{ background: rgba(162,74,255,.18); border-color: rgba(162,74,255,.5); color:#d3b7ff; }
.badge.rma_closed          { background: rgba(153,153,153,.18); border-color: rgba(153,153,153,.5); color:#cccccc; }
.badge.replacement_received{ background: rgba(62,207,142,.25); border-color: rgba(62,207,142,.5); color:#cdfada; }
.badge.in_inventory        { background: rgba(62,207,142,.18); border-color: rgba(62,207,142,.5); color:#bef2d6; }
.badge.out_of_warranty     { background: rgba(242,85,90,.12); border-color: rgba(242,85,90,.4); color:#ffb4b6; }
.badge.rejected            { background: rgba(242,85,90,.12); border-color: rgba(242,85,90,.4); color:#ffb4b6; }
.badge.disposed            { background: rgba(100,100,100,.18); border-color: rgba(100,100,100,.5); color:#aaaaaa; }

.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }

.login-box {
    max-width: 22rem;
    margin: 6rem auto;
}
.login-box h1 { text-align: center; margin-bottom: 1.5rem; }

pre.log {
    background: #0a0d12;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    color: #c0f0c8;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.kv dt { color: var(--muted); }

details.raw { margin-top: 1rem; }
details.raw summary { cursor: pointer; color: var(--muted); }

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.stat .num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: .85rem; }

.scan-hint {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 1rem;
    padding: .75rem 1rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}

/* Sortable table headers */
th.sortable a, th.sort-active a {
    color: inherit;
    text-decoration: none;
    display: block;
}
th.sortable a:hover { color: var(--accent); text-decoration: none; }
th.sort-active { color: var(--accent); }
th.sort-active a { color: var(--accent); }

/* Pagination strip */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: .6rem 0;
    margin: .5rem 0;
    color: var(--muted);
    font-size: .9rem;
}
.pager-summary { flex: 1 1 auto; }
.pager-per, .pager-nav { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.pager-per a, .pager-nav a {
    padding: .15rem .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    text-decoration: none;
    background: var(--surface);
}
.pager-per a:hover, .pager-nav a:hover { background: var(--surface-2); color: var(--text); }
.pager-per .pager-per-active { background: var(--accent); color: #001; border-color: var(--accent); font-weight: 600; }
.pager-page { padding: 0 .4rem; }

/* Report actions (export/print buttons row) */
.report-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin: .75rem 0 1rem;
}

/* Print-friendly view — Browser's Print / Save-as-PDF produces a clean document */
@media print {
    .topbar, .pager, .report-actions, .actions, form, button, .linklike { display: none !important; }
    body { background: white; color: black; }
    .container { max-width: none; margin: 0; padding: 0; }
    .card { background: white; border: 0; padding: 0; }
    table { border-collapse: collapse; width: 100%; font-size: 10pt; }
    th { background: #eee !important; color: black !important; border-bottom: 1px solid #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    td { border-bottom: 1px solid #ddd; padding: 4px 6px; color: black; }
    tr:nth-child(odd) td { background: #f8f8f8; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: black; text-decoration: none; }
    .badge { border: 1px solid #888; background: white !important; color: black !important; }
    h1, h2, h3 { color: black; page-break-after: avoid; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; page-break-after: auto; }
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    .muted { color: #555 !important; }
    .print-only { display: block !important; }
    @page { margin: 1.5cm; }
}
.print-only { display: none; }
