/* =============================================================
   RENT A CAR — ADMIN THEME
   Bootstrap 5.3 + Custom Sidebar Layout
   ============================================================= */

/* ---- CSS Variables ---- */
:root {
    --sidebar-width: 240px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-heading: #475569;
    --sidebar-hover-bg: #1e293b;
    --sidebar-active-bg: #1d4ed8;
    --sidebar-active-text: #ffffff;
    --sidebar-border: #1e293b;
    --topbar-height: 62px;
    --topbar-bg: #ffffff;
    --body-bg: #f1f5f9;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,.1);
    --accent: #1d4ed8;
    --accent-light: #eff6ff;
    --text-muted-custom: #64748b;
    --radius: 10px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .9rem;
    color: #1e293b;
}

/* =============================================================
   SIDEBAR
   ============================================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1040;
    transition: width .25s ease;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    text-decoration: none;
    white-space: nowrap;
}
.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}
.sidebar-brand-text {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.3px;
}

/* Divider */
.sidebar-divider {
    border-color: var(--sidebar-border);
    margin: 0 16px 8px;
    opacity: 1;
}

/* Section Headings */
.sidebar-heading {
    color: var(--sidebar-heading);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 12px 20px 4px;
    list-style: none;
    white-space: nowrap;
}

/* Nav Links */
.sidebar-nav {
    padding: 0 10px 20px;
    flex: 1;
}
.sidebar-nav .nav-item { margin-bottom: 2px; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--sidebar-text);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: #e2e8f0;
}
.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}
.sidebar-nav .nav-link i {
    font-size: .95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* =============================================================
   CONTENT WRAPPER
   ============================================================= */
#content-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

/* Collapsed sidebar */
body.sidebar-collapsed .sidebar { width: 62px; }
body.sidebar-collapsed #content-wrapper { margin-left: 62px; }
body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-heading,
body.sidebar-collapsed .sidebar-nav .nav-link span { opacity: 0; width: 0; overflow: hidden; }
body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; }

/* =============================================================
   TOPBAR
   ============================================================= */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.topbar-title {
    font-size: .95rem;
    font-weight: 600;
    color: #475569;
}

/* Avatar circle */
.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
}

/* =============================================================
   PAGE CONTENT
   ============================================================= */
.page-content {
    flex: 1;
    padding: 28px 28px 40px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.2rem;
    color: #0f172a;
}
.breadcrumb {
    margin: 0;
    font-size: .8rem;
}

/* =============================================================
   DASHBOARD SUMMARY CARDS
   ============================================================= */
.stat-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--card-shadow);
    transition: box-shadow .2s, transform .2s;
    height: 100%;
}
.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}
.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-card-icon.blue   { background: #eff6ff; color: #1d4ed8; }
.stat-card-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-card-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-card-icon.yellow { background: #fefce8; color: #ca8a04; }
.stat-card-icon.teal   { background: #f0fdfa; color: #0d9488; }

.stat-card-body { min-width: 0; }
.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    color: #0f172a;
    letter-spacing: -.5px;
}
.stat-card-label {
    font-size: .78rem;
    color: var(--text-muted-custom);
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* =============================================================
   CONTENT CARDS (Tables, Forms)
   ============================================================= */
.content-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.content-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    gap: 12px;
    flex-wrap: wrap;
}
.content-card-header h6 {
    margin: 0;
    font-weight: 700;
    font-size: .9rem;
    color: #0f172a;
}
.content-card-body { padding: 0; }

/* =============================================================
   TABLES
   ============================================================= */
.table-app {
    width: 100%;
    margin: 0;
    font-size: .855rem;
}
.table-app thead th {
    background: #f8fafc;
    color: var(--text-muted-custom);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--card-border);
    padding: 11px 16px;
    white-space: nowrap;
}
.table-app tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}
.table-app tbody tr:last-child { border-bottom: none; }
.table-app tbody tr:hover { background: #f8fafc; }
.table-app tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    color: #1e293b;
}

/* =============================================================
   STATUS BADGES
   ============================================================= */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge-showroom  { background: #f0fdf4; color: #16a34a; }
.badge-allocated { background: #eff6ff; color: #1d4ed8; }
.badge-maintenance { background: #fff7ed; color: #ea580c; }
.badge-paid      { background: #f0fdf4; color: #16a34a; }
.badge-partial   { background: #fefce8; color: #ca8a04; }
.badge-unpaid    { background: #fef2f2; color: #dc2626; }
.badge-active    { background: #eff6ff; color: #1d4ed8; }
.badge-returned  { background: #f8fafc; color: #64748b; }
.badge-inprogress { background: #fff7ed; color: #ea580c; }
.badge-completed { background: #f0fdf4; color: #16a34a; }

/* =============================================================
   BUTTONS
   ============================================================= */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: #1e40af;
    border-color: #1e40af;
}
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: .8rem;
}

/* =============================================================
   MODAL CUSTOMIZATION
   ============================================================= */
.modal-header { padding: 18px 22px 12px; }
.modal-body   { padding: 16px 22px; }
.modal-footer { padding: 12px 22px 18px; border-top: 1px solid var(--card-border); }
.modal-title  { font-size: 1rem; }

/* =============================================================
   FORMS
   ============================================================= */
.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
}
.form-control, .form-select {
    border-color: #cbd5e1;
    border-radius: 7px;
    font-size: .875rem;
    padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}

/* Select2 height fix */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
    border-color: #cbd5e1;
    border-radius: 7px;
    font-size: .875rem;
}

/* =============================================================
   TOAST
   ============================================================= */
.toast { border: none; box-shadow: 0 4px 20px rgba(0,0,0,.12); border-radius: 8px; }
.toast-success { background: #16a34a; color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-warning { background: #ca8a04; color: #fff; }

/* =============================================================
   LOGIN PAGE
   ============================================================= */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,.3);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}
.login-card-header {
    background: var(--sidebar-bg);
    padding: 32px 36px 28px;
    text-align: center;
}
.login-card-header .brand-icon {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    margin: 0 auto 14px;
}
.login-card-header h4 {
    color: #fff;
    margin: 0 0 4px;
    font-weight: 800;
    font-size: 1.3rem;
}
.login-card-header p {
    color: var(--sidebar-text);
    margin: 0;
    font-size: .83rem;
}
.login-card-body { padding: 32px 36px; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1045;
    }
    #content-wrapper { margin-left: 0 !important; }
    .page-content { padding: 16px; }
}

/* =============================================================
   MISC UTILITIES
   ============================================================= */
.text-money { font-weight: 700; color: #16a34a; font-variant-numeric: tabular-nums; }
.cursor-pointer { cursor: pointer; }
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted-custom);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: .35; display: block; }



/* =============================================================
   PHASE 3 CSS ADDITIONS — append to site.css
   ============================================================= */

/* ── Allocation Modal ─────────────────────────────────────── */
.allocate-customer-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.allocate-customer-icon {
    width: 40px;
    height: 40px;
    background: #1d4ed8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.allocate-customer-name {
    font-weight: 700;
    font-size: .95rem;
    color: #1e293b;
}

.allocate-customer-meta {
    font-size: .78rem;
    color: #64748b;
    margin-top: 2px;
}

/* ── Calculation Row ──────────────────────────────────────── */
.allocate-calc-row {
    display: flex;
    align-items: stretch;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.allocate-calc-item {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
}

.allocate-calc-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #94a3b8;
    margin-bottom: 4px;
}

.allocate-calc-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.allocate-calc-divider {
    width: 1px;
    background: #e2e8f0;
    margin: 10px 0;
}

/* ── Summary Pill ─────────────────────────────────────────── */
.allocation-summary-pill {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: .8rem;
    font-weight: 600;
}

/* ── Detail Page ──────────────────────────────────────────── */
.detail-info-block {
    padding: 2px 0 10px;
}

.detail-info-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #94a3b8;
    margin-bottom: 2px;
}

.detail-info-value {
    font-size: .9rem;
    color: #1e293b;
}

.detail-info-sub {
    font-size: .78rem;
    color: #64748b;
    margin-top: 2px;
}

/* ── Financial Summary ────────────────────────────────────── */
.fin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid #f1f5f9;
}

    .fin-row:last-child {
        border-bottom: none;
    }

.fin-label {
    font-size: .82rem;
    color: #64748b;
}

.fin-value {
    font-size: .88rem;
    color: #1e293b;
}

.fin-row-highlight {
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 8px;
    border: none !important;
}

.fin-row-danger {
    background: #fef2f2;
}

.fin-row-success {
    background: #f0fdf4;
}

/* ── Days Remaining Indicators ────────────────────────────── */
tr.table-danger td {
    background-color: #fff5f5 !important;
}

tr.table-warning td {
    background-color: #fffbeb !important;
}

/* ── Active Rentals Stats ─────────────────────────────────── */
.stat-card-icon.orange {
    background: #fff7ed;
    color: #ea580c;
}

/* ── Dropdown Actions col ─────────────────────────────────── */
.dropdown-menu .dropdown-item {
    border-radius: 6px;
    margin: 1px 4px;
    padding: 7px 12px;
    font-size: .85rem;
    transition: background .12s;
}

.dropdown-menu {
    padding: 6px;
}
