/* ═══════════════════════════════════════════════════════════════════════════
   RS Flow — Main Stylesheet
   Colors: Charcoal #2c3a4a (R), Steel Blue #6b8fbe (S), BG #f0f4f8
   Compact sizing: 87.5% root font-size = ~14px base, no body zoom needed
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --rs-sidebar-w:    200px;
    --rs-topbar-h:     44px;
    --rs-bg:           #f0f4f8;
    --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;
}

/* ── Global compact scale (no body zoom needed) ───────────────────────────── */
html { font-size: 87.5%; }   /* 14px base — matches maridadilounge scale */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, 'Outfit', sans-serif;
    font-size: .82rem;
    background: var(--rs-bg);
    color: var(--rs-text);
    -webkit-font-smoothing: antialiased;
}

/* ── Bootstrap compact overrides ─────────────────────────────────────────── */
.form-control, .form-select { font-size: .78rem !important; padding: .24rem .48rem !important; }
.form-control-sm, .form-select-sm { font-size: .74rem !important; padding: .18rem .4rem !important; }
.form-label  { font-size: .74rem; margin-bottom: .2rem; font-weight: 600; color: #374151; }
.btn         { font-size: .78rem !important; padding: .24rem .58rem !important; }
.btn-sm      { font-size: .72rem !important; padding: .18rem .44rem !important; }
.btn-lg      { font-size: .88rem !important; padding: .4rem .9rem !important; }
.badge       { font-size: .62rem !important; }
.table-sm td, .table-sm th { padding: .28rem .5rem !important; font-size: .76rem; }
.table th    { font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--rs-text-muted); }
.card        { border-radius: 8px !important; }
.card.border-0.shadow-sm { box-shadow: 0 1px 5px rgba(0,0,0,.07) !important; }
.dropdown-item { font-size: .78rem; padding: .3rem .9rem; }
.modal-title   { font-size: .88rem; }
.modal-body    { font-size: .80rem; }

/* ── Layout Shell ─────────────────────────────────────────────────────────── */
.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; overflow-x: hidden;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.rs-sidebar::-webkit-scrollbar { width: 3px; }
.rs-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.rs-sidebar-brand {
    padding: 12px 14px 10px;
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    text-decoration: none; flex-shrink: 0;
}
.rs-sidebar-brand img { height: 28px; width: auto; object-fit: contain; }
.rs-sidebar-brand .brand-name  { color: #fff; font-weight: 700; font-size: .75rem; letter-spacing: .2px; line-height: 1.1; }
.rs-sidebar-brand .brand-sub   { color: var(--rs-sidebar-sec); font-size: .58rem; letter-spacing: 1px; text-transform: uppercase; }

.rs-nav { flex: 1; padding: 5px 0 4px; }
.rs-nav ul { list-style: none; margin: 0; padding: 0; }

.rs-nav-section {
    font-size: .57rem; font-weight: 700; letter-spacing: 1.2px;
    color: var(--rs-sidebar-sec); text-transform: uppercase;
    padding: 10px 14px 3px;
}

.rs-nav-link {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 14px; color: var(--rs-sidebar-txt);
    text-decoration: none; font-size: .74rem; font-weight: 400;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
}
.rs-nav-link:hover  { background: rgba(255,255,255,.05); color: #fff; border-left-color: var(--rs-accent-light); }
.rs-nav-link.active { background: var(--rs-accent-light); color: #fff; border-left-color: var(--rs-accent); font-weight: 500; }
.rs-nav-link i      { width: 13px; text-align: center; font-size: .74rem; opacity: .82; flex-shrink: 0; }
.rs-nav-link.active i { opacity: 1; }
.rs-nav-link .badge { margin-left: auto; }

/* ── Sidebar footer (user) ────────────────────────────────────────────────── */
.rs-sidebar-footer {
    padding: 8px 14px; border-top: 1px solid rgba(255,255,255,.07);
    display: flex; align-items: center; gap: 8px; 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;
}
.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; margin-top: 1px; }

/* ── Main Area ────────────────────────────────────────────────────────────── */
.rs-main { margin-left: var(--rs-sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.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-topbar .date-pill    { font-size: .68rem; color: var(--rs-text-muted); font-variant-numeric: tabular-nums; }
.rs-sidebar-toggle {
    background: none; border: none; cursor: pointer;
    color: var(--rs-text-muted); padding: .22rem .4rem;
    border-radius: 4px; font-size: .9rem; line-height: 1;
}
.rs-sidebar-toggle:hover { background: var(--rs-bg); color: var(--rs-text); }

/* ── Content ──────────────────────────────────────────────────────────────── */
.rs-content { flex: 1; padding: 16px; }

/* ── RS 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); }
.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 ───────────────────────────────────────────────────────────────── */
.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); }
.table-hover tbody tr:hover td { background: #f3f7ff; }

/* ── Button colours ───────────────────────────────────────────────────────── */
.btn-primary   { background: var(--rs-accent) !important; border-color: var(--rs-accent) !important; color: #fff !important; }
.btn-primary:hover { background: var(--rs-accent-dark) !important; border-color: var(--rs-accent-dark) !important; }
.btn-outline-primary { color: var(--rs-accent) !important; border-color: var(--rs-accent) !important; }
.btn-outline-primary:hover { background: var(--rs-accent) !important; border-color: var(--rs-accent) !important; color: #fff !important; }
.badge.bg-primary { background-color: var(--rs-accent) !important; }

/* ── POS specific ─────────────────────────────────────────────────────────── */
.pos-product-card {
    cursor: pointer; border: 1px solid var(--rs-border) !important;
    border-radius: 7px !important; transition: border-color .12s, box-shadow .12s;
    background: #fff;
}
.pos-product-card:hover { border-color: var(--rs-accent) !important; box-shadow: 0 2px 8px rgba(107,143,190,.2) !important; }
.pos-product-card.oos   { opacity: .45; cursor: not-allowed; }
.pos-product-name  { font-size: .74rem; font-weight: 600; line-height: 1.25; color: var(--rs-text); }
.pos-product-sku   { font-size: .62rem; color: var(--rs-text-muted); }
.pos-product-price { font-size: .8rem; font-weight: 700; color: var(--rs-accent); margin-top: 3px; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.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);
}

/* ── Modal overlay ────────────────────────────────────────────────────────── */
.modal-backdrop { z-index: 1040; }
.modal          { z-index: 1050; }

/* ── Media picker ─────────────────────────────────────────────────────────── */
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: .5rem; }
.mp-item { border: 2px solid transparent; border-radius: 7px; overflow: hidden; cursor: pointer; background: #f8f9fa; transition: border-color .13s; }
.mp-item:hover { border-color: var(--rs-accent); }
.mp-item img { width: 100%; height: 88px; object-fit: cover; display: block; }
.mp-item-icon { width: 100%; height: 88px; display: flex; align-items: center; justify-content: center; }
.mp-item-name { font-size: .63rem; padding: .2rem .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; border-top: 1px solid #f0f0f0; }
.mp-upload-zone { border: 2px dashed #adb5bd; border-radius: 10px; padding: 2.5rem 1rem; text-align: center; cursor: pointer; transition: border-color .2s,background .2s; }
.mp-upload-zone:hover, .mp-upload-zone.dragover { border-color: var(--rs-accent); background: #eef4fd; }
.mp-upload-zone i { font-size: 2rem; color: #adb5bd; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .rs-sidebar { transform: translateX(-100%); }
    .rs-sidebar.mobile-open { transform: translateX(0); }
    .rs-main { margin-left: 0; }
}
