/* ============================================================
   OmSai One – Main Stylesheet
   Bootstrap 5 is the base; this file adds the custom layout
   and branding layer on top.
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --sidebar-width:      250px;
    --sidebar-collapsed:  68px;
    --navbar-height:      58px;
    --sidebar-bg:         #1a237e;
    --sidebar-hover:      rgba(255,255,255,.08);
    --sidebar-active:     rgba(255,255,255,.16);
    --sidebar-text:       rgba(255,255,255,.85);
    --sidebar-icon:       rgba(255,255,255,.6);
    --brand-orange:       #f57c00;
    --primary:            #1a237e;
    --primary-light:      #3949ab;
    --card-shadow:        0 2px 12px rgba(0,0,0,.06);
    --radius:             10px;
    --transition:         .2s ease;
}

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #212529;
    overflow-x: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width var(--transition), transform var(--transition);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.2) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    min-height: var(--navbar-height);
}
.sidebar-brand a { display: flex; align-items: center; gap: 10px; }
.brand-icon {
    width: 36px; height: 36px;
    background: var(--brand-orange);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
    flex-shrink: 0;
}
.brand-name {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -.5px;
    white-space: nowrap;
}

/* User info strip */
.sidebar-user-info {
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-company-name {
    color: rgba(255,255,255,.6);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    max-width: calc(var(--sidebar-width) - 36px);
}

/* Nav */
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav .nav { gap: 1px; }

.sidebar-nav .nav-item { width: 100%; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: var(--sidebar-text);
    border-radius: 0;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
    font-size: .875rem;
}
.sidebar-nav .nav-link:hover  { background: var(--sidebar-hover);  color: #fff; }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-nav .nav-link .nav-icon {
    width: 20px;
    text-align: center;
    color: var(--sidebar-icon);
    font-size: .9rem;
    flex-shrink: 0;
    transition: color var(--transition);
}
.sidebar-nav .nav-link.active .nav-icon,
.sidebar-nav .nav-link:hover  .nav-icon { color: rgba(255,255,255,.9); }

/* Divider */
.sidebar-divider {
    list-style: none;
    padding: 14px 18px 4px;
}
.sidebar-divider span {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.35);
    font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.3);
    font-size: .7rem;
}

/* ── Sidebar Overlay (mobile) ──────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1039;
}
.sidebar-overlay.active { display: block; }

/* ── Page Wrapper ──────────────────────────────────────────── */
.page-wrapper {
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ── Top Navbar ─────────────────────────────────────────────── */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--navbar-height);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.top-navbar .navbar-text { font-size: .95rem; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 24px;
}

/* ── App Footer ─────────────────────────────────────────────── */
.app-footer {
    padding: 12px 24px;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

/* ── Page Title ─────────────────────────────────────────────── */
.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0;
}
.page-subtitle { color: #6c757d; font-size: .85rem; }

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: transform .15s, box-shadow .15s;
    overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.stat-card .card-body { padding: 20px; }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-value  { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label  { font-size: .78rem; color: #6c757d; text-transform: uppercase; letter-spacing: .5px; }
.stat-change { font-size: .78rem; }

/* Colour helpers */
.bg-primary-soft { background: rgba(26,35,126,.1); color: var(--primary); }
.bg-success-soft { background: rgba(25,135,84,.1);  color: #198754; }
.bg-warning-soft { background: rgba(255,193,7,.1);  color: #997404; }
.bg-danger-soft  { background: rgba(220,53,69,.1);  color: #dc3545; }
.bg-info-soft    { background: rgba(13,202,240,.1); color: #0dcaf0; }
.bg-orange-soft  { background: rgba(245,124,0,.1);  color: #f57c00; }

/* ── Content Cards ───────────────────────────────────────────── */
.content-card {
    background: #fff;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}
.content-card .card-header {
    background: #fff;
    border-bottom: 1px solid #f0f2f5;
    padding: 16px 20px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.content-card .card-header h5,
.content-card .card-header h6 { margin: 0; font-weight: 700; color: var(--primary); }
.content-card .card-body { padding: 20px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-card { border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
.table thead th {
    background: #f8f9fa;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6c757d;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding: 12px 14px;
    white-space: nowrap;
}
.table tbody td { padding: 11px 14px; vertical-align: middle; font-size: .875rem; }
.table tbody tr:hover { background: #f8f9fb; }
.table-responsive { border-radius: var(--radius); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { font-size: .72rem; font-weight: 600; padding: .35em .65em; }

/* ── Action Buttons ─────────────────────────────────────────── */
.btn-action { padding: .25rem .55rem; font-size: .78rem; border-radius: 6px; }
.btn-group-action { display: flex; gap: 4px; flex-wrap: nowrap; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label { font-size: .85rem; font-weight: 600; color: #495057; }
.form-control, .form-select {
    border-radius: 8px;
    border-color: #dee2e6;
    font-size: .875rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 .2rem rgba(57,73,171,.15);
}

/* ── POS / Billing Screen ─────────────────────────────────────── */
.pos-cart-item { border-bottom: 1px solid #f0f2f5; padding: 8px 0; }
.pos-cart-item:last-child { border-bottom: none; }
.pos-total-row { font-size: 1rem; font-weight: 600; }
.pos-grand-total { font-size: 1.4rem; font-weight: 800; color: var(--primary); }

/* ── Responsive: Collapse sidebar on mobile ─────────────────── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .page-wrapper {
        margin-left: 0;
    }
}

/* ── Animations / Utilities ─────────────────────────────────── */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.cursor-pointer { cursor: pointer; }
.text-primary-custom { color: var(--primary) !important; }
.fw-600 { font-weight: 600; }

/* ── Chart containers ─────────────────────────────────────────── */
.chart-container { position: relative; width: 100%; }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    .sidebar, .top-navbar, .app-footer, .no-print { display: none !important; }
    .page-wrapper { margin-left: 0 !important; }
    .main-content { padding: 0 !important; }
}
