/* ── TookuApp Spares — RS-Flow 13 admin style ── */
:root {
    --rs-sidebar-w:    200px;
    --rs-topbar-h:     44px;
    --rs-bg:           #fafcfe;
    --rs-sidebar-bg:   #2c3a4a;
    --rs-sidebar-txt:  rgba(255,255,255,.68);
    --rs-sidebar-sec:  rgba(255,255,255,.28);
    --rs-accent:       #6b8fbe;
    --rs-accent-light: rgba(107,143,190,.14);
    --rs-accent-dark:  #4d6f99;
    --rs-text:         #1e2d3d;
    --rs-text-muted:   #6b7a8d;
    --rs-border:       #e2e8f0;
    --rs-card-bg:      #ffffff;
    --rs-topbar-bg:    #ffffff;
    --rs-danger:       #dc2626;
    --rs-success:      #16a34a;
    --rs-warning:      #d97706;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[v-cloak] { display: none; }
html { font-size: 87.5%; }
body {
    font-family: 'Segoe UI', system-ui, 'Outfit', sans-serif;
    font-size: .82rem;
    background: var(--rs-bg);
    color: var(--rs-text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── Layout ── */
.rs-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.rs-sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--rs-sidebar-w); height: 100vh;
    background: var(--rs-sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 1000; overflow-y: auto;
}
.rs-sidebar-brand {
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.rs-sidebar-brand .brand-name  { color: #fff; font-weight: 700; font-size: .75rem; letter-spacing: .2px; }
.rs-sidebar-brand .brand-sub   { color: var(--rs-sidebar-sec); font-size: .58rem; letter-spacing: 1px; text-transform: uppercase; display: block; margin-top: 2px; }

.rs-nav { flex: 1; padding: 5px 0 4px; }
.rs-nav a {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 14px; color: var(--rs-sidebar-txt);
    text-decoration: none; font-size: .74rem;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
    cursor: pointer;
}
.rs-nav a:hover  { background: rgba(255,255,255,.05); color: #fff; border-left-color: var(--rs-accent-light); }
.rs-nav a.active { background: var(--rs-accent-light); color: #fff; border-left-color: var(--rs-accent); font-weight: 500; }

.rs-sidebar-footer {
    padding: 8px 14px; border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.rs-user-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--rs-accent-light); color: var(--rs-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: .68rem; font-weight: 700; flex-shrink: 0;
    margin-right: 8px;
}
.rs-user-row { display: flex; align-items: center; margin-bottom: 6px; }
.rs-user-name { color: #fff; font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-user-role { color: rgba(255,255,255,.38); font-size: .58rem; }

/* ── Main ── */
.rs-main { margin-left: var(--rs-sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.rs-topbar {
    position: sticky; top: 0; z-index: 900;
    height: var(--rs-topbar-h);
    background: var(--rs-topbar-bg);
    border-bottom: 1px solid var(--rs-border);
    display: flex; align-items: center; gap: 12px;
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.rs-topbar .page-title   { font-size: .82rem; font-weight: 700; color: var(--rs-text); }
.rs-topbar .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.rs-content { flex: 1; padding: 16px; }

/* ── Sub-nav (sibling pages of the active sidebar group) ─────────────
   Rendered right under the topbar. Uses light pills so it reads as a
   secondary navigation surface, not a primary action. */
.rs-subnav {
    background: #fff;
    border-bottom: 1px solid var(--rs-border);
    position: sticky;
    top: var(--rs-topbar-h);
    z-index: 800;
}
.rs-subnav .subnav-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px;
    font-size: .74rem;
    color: var(--rs-text-muted);
    text-decoration: none;
    border-radius: 14px;
    border: 1px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
    white-space: nowrap;
}
.rs-subnav .subnav-pill:hover      { background: var(--rs-bg); color: var(--rs-text); }
.rs-subnav .subnav-pill.is-active  { background: var(--rs-accent-light); color: var(--rs-accent-dark); border-color: transparent; font-weight: 600; }
.rs-subnav .rs-nav-badge           { font-size: .58rem; padding: 1px 5px; }
/* On collapsed-sidebar mode the subnav should hug the same content edge. */
body.sidebar-collapsed .rs-subnav  { /* no change; sticky is fine */ }

/* ── Cards ── */
.rs-card { background: var(--rs-card-bg); border-radius: 8px; border: 1px solid var(--rs-border); box-shadow: 0 1px 4px rgba(44,58,74,.06); padding: 16px; margin-bottom: 16px; }
.rs-stat-card { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.rs-stat-card .stat-value { font-size: 1.5rem; font-weight: 800; color: var(--rs-text); line-height: 1; }
.rs-stat-card .stat-label { font-size: .67rem; color: var(--rs-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.rs-stat-card .stat-icon  { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.rs-stat-card .stat-icon.blue  { background: var(--rs-accent-light); color: var(--rs-accent); }
.rs-stat-card .stat-icon.green { background: rgba(34,197,94,.12);    color: #16a34a; }
.rs-stat-card .stat-icon.amber { background: rgba(245,158,11,.12);   color: #d97706; }
.rs-stat-card .stat-icon.red   { background: rgba(239,68,68,.12);    color: #dc2626; }

/* ── Tables ── */
.data-table {
    width: 100%; background: #fff;
    border-radius: 8px; border: 1px solid var(--rs-border);
    box-shadow: 0 1px 4px rgba(44,58,74,.06);
    border-collapse: collapse; margin-bottom: 16px;
}
.data-table thead tr th {
    background: #f7f9fc; font-size: .68rem; font-weight: 700;
    letter-spacing: .06em; color: var(--rs-text-muted);
    text-transform: uppercase; border-bottom: 1px solid var(--rs-border);
    padding: 8px 12px; text-align: left;
}
.data-table tbody td {
    padding: 7px 12px; font-size: .78rem;
    border-bottom: 1px solid #f1f5f9;
}
.data-table tbody tr:hover td { background: #f3f7ff; }
.clickable-row { cursor: pointer; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }

/* ── Toolbar ── */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.toolbar-label { font-size: .74rem; font-weight: 600; color: var(--rs-text); }

/* ── Form Elements ── */
.form-input, .search-input, .select-input {
    padding: .24rem .48rem; border: 1px solid var(--rs-border);
    border-radius: 4px; font-size: .78rem; outline: none;
    background: #fff; color: var(--rs-text);
    transition: border-color .2s;
}
.form-input:focus, .search-input:focus, .select-input:focus {
    border-color: var(--rs-accent); box-shadow: 0 0 0 2px rgba(107,143,190,.15);
}
.search-input { width: 260px; }
.form-input { width: 100%; display: block; }
.small-input { width: 72px; padding: .18rem .4rem; font-size: .74rem; border: 1px solid var(--rs-border); border-radius: 4px; }
.full-width { width: 100%; }

/* ── Buttons ── */
.btn {
    padding: .24rem .58rem; border: 1px solid var(--rs-border);
    background: #fff; border-radius: 4px;
    cursor: pointer; font-size: .78rem; color: var(--rs-text);
    transition: all .15s; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--rs-bg); }
.btn-primary { background: var(--rs-accent); color: #fff; border-color: var(--rs-accent); }
.btn-primary:hover { background: var(--rs-accent-dark); border-color: var(--rs-accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { background: var(--rs-danger); color: #fff; border-color: var(--rs-danger); }
.btn-sm { font-size: .72rem; padding: .18rem .44rem; }
.btn-lg { font-size: .88rem; padding: .4rem .9rem; }

/* ── Form Group ── */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: .74rem; font-weight: 600; color: var(--rs-text); margin-bottom: 3px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group-half { flex: 1; min-width: 0; }
textarea.form-input { resize: vertical; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; font-size: .78rem; }
.pagination button { padding: .2rem .5rem; border: 1px solid var(--rs-border); background: #fff; border-radius: 4px; cursor: pointer; font-size: .72rem; }
.pagination button:disabled { opacity: .4; cursor: default; }

/* ── Quick Search Results ── */
.quick-results { border: 1px solid var(--rs-border); border-radius: 4px; max-height: 240px; overflow-y: auto; margin: 6px 0 12px 0; background: #fff; }
.quick-item { padding: 7px 12px; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: .78rem; }
.quick-item:hover { background: #f3f7ff; }
.stock-badge { display: inline-block; padding: 1px 6px; background: var(--rs-bg); border-radius: 10px; font-size: .68rem; color: var(--rs-text-muted); margin-left: 6px; }

/* ── Login ── */
.rs-login-bg {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--rs-sidebar-bg) 0%, #1a2636 100%);
}
.rs-login-card {
    background: #fff; border-radius: 10px; padding: 2rem 1.75rem;
    width: 100%; max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.rs-login-card h1 { text-align: center; margin-bottom: 1.25rem; color: var(--rs-accent); font-size: 1.1rem; font-weight: 700; }
.rs-login-card .form-input { margin-bottom: 10px; }
.rs-login-card .btn-primary { margin-top: 6px; }

/* ── Utility ── */
.text-danger { color: var(--rs-danger); font-weight: 600; }
.text-success { color: var(--rs-success); font-weight: 600; }
.alert { padding: 8px 12px; border-radius: 4px; font-size: .78rem; margin-bottom: 12px; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #2563eb; border: 1px solid #bfdbfe; }

/* ── Bootstrap 5 compatibility layer ─────────────────────────────────────
   Bootstrap 5 is loaded on every admin layout so the app can gradually
   adopt the Bootstrap grid + form classes. But tookuapp views were built
   against BS4-style badge / status colour classes (badge-warning,
   badge-success …). BS5 replaced those with .text-bg-{color} pairs, so
   the old class names would render as an un-styled base badge without
   these overrides. Colours match tookuapp's palette. */
.badge          { display: inline-block; padding: .18em .5em; font-size: .68rem; font-weight: 600; border-radius: 10px; line-height: 1.2; }
.badge-warning  { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-success  { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-danger   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info     { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-secondary{ background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
/* Bootstrap 5 leaves body font-family / size undefined so ours (from body{}
   above) wins. But BS5 sets tight line-height on .btn (1.5) and default
   1rem font-size, which would enlarge tookuapp buttons — our .btn rule
   below overrides the size, and this ensures the two-line collapse is
   avoided when a .btn is placed inside a Bootstrap grid cell. */
.btn { line-height: 1.35; vertical-align: middle; }

.text-muted { color: var(--rs-text-muted); }
h1 { font-size: .95rem; font-weight: 700; color: var(--rs-text); margin-bottom: 14px; }
h2 { font-size: .8rem; font-weight: 700; color: var(--rs-text-muted); margin: 16px 0 8px 0; text-transform: uppercase; letter-spacing: .04em; }

/* ── Lang switch ── */
.lang-switch { display: flex; gap: 3px; margin-bottom: 8px; }
.lang-switch button {
    flex: 1; padding: 3px 6px; border: 1px solid rgba(255,255,255,.2);
    background: transparent; color: var(--rs-sidebar-txt);
    cursor: pointer; border-radius: 3px; font-size: .65rem;
}
.lang-switch button.active { background: var(--rs-accent); border-color: var(--rs-accent); color: #fff; }

/* ── Sign In button ── */
.btn-signin {
    background: linear-gradient(135deg, #6b8fbe 0%, #4f6fa5 100%);
    color: #fff;
    border: none;
    padding: .52rem 1rem;
    font-weight: 600;
    font-size: .88rem;
    border-radius: 6px;
    transition: background .2s, transform .1s;
    cursor: pointer;
}
.btn-signin:hover { background: linear-gradient(135deg, #5a7eae 0%, #3e5d94 100%); color: #fff; }
.btn-signin:active { transform: scale(0.98); }

/* ── Language buttons on login ── */
.lang-switch .lang-btn {
    flex: 1; padding: 4px 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer; border-radius: 4px;
    font-size: .7rem; font-weight: 600;
    transition: all .15s;
}
.lang-switch .lang-btn.active { background: var(--rs-accent); border-color: var(--rs-accent); color: #fff; }
.lang-switch .lang-btn:hover:not(.active) { background: #e2e8f0; }

/* Modal — Bootstrap 5 owns .modal / .modal-dialog / .modal-content / .modal-header
   / .modal-body / .modal-footer / .modal-lg. Legacy .modal-overlay + .modal-box
   removed as part of the BS5 sweep. */

/* ── Asset Detail ── */
.asset-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .asset-detail-grid { grid-template-columns: 1fr; } }
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table td { padding: 5px 8px; font-size: .76rem; border-bottom: 1px solid #f1f5f9; }
.detail-table td:first-child { color: var(--rs-text-muted); font-weight: 600; width: 35%; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.image-thumb-wrap { position: relative; border: 1px solid var(--rs-border); border-radius: 6px; overflow: hidden; }
.image-thumb { width: 100%; height: 120px; object-fit: cover; cursor: pointer; display: block; }
.image-delete-btn { position: absolute; top: 4px; right: 4px; padding: 1px 6px !important; }

/* ── Autocomplete dropdown ── */
.autocomplete-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--rs-card-bg);
    border: 1px solid var(--rs-accent);
    border-radius: 0 0 8px 8px;
    max-height: 260px; overflow-y: auto;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    margin-top: -1px;
}
.autocomplete-item {
    padding: 8px 12px; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: .78rem;
    transition: background .1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--rs-accent-light); }
.autocomplete-item .ac-partno {
    font-weight: 700; color: var(--rs-accent);
    font-size: .8rem; white-space: nowrap;
}
.autocomplete-item .ac-desc {
    flex: 1; color: var(--rs-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.autocomplete-item .ac-stock {
    font-size: .68rem; color: var(--rs-text-muted);
    background: var(--rs-bg); padding: 2px 8px; border-radius: 10px;
    white-space: nowrap;
    min-width: 60px; text-align: center;
}
.autocomplete-empty {
    padding: 10px 14px;
    color: var(--rs-text-muted);
    font-style: italic;
    font-size: .78rem;
    text-align: center;
}

/* ── Loading ── */
.loading-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--rs-bg); }
.loading-spinner { width: 36px; height: 36px; border: 3px solid var(--rs-border); border-top-color: var(--rs-accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
    .rs-sidebar { position: relative; width: 100%; height: auto; min-height: auto; }
    .rs-main { margin-left: 0; }
    .rs-wrapper { flex-direction: column; }
    .search-input { width: 100%; }
}

/* ── Dropdown search results ── */
.dropdown-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: .84rem;
    border-bottom: 1px solid #f1f5f9;
}
.dropdown-item:hover { background: #f0f4f8; }
.small-input {
    padding: 2px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: .78rem;
}
