/* ============================================================
   Global Auto Import — back-office stylesheet (offline edition)
   ------------------------------------------------------------
   Sober corporate look: slate sidebar, white content area,
   one blue accent, dense readable typography. Designed to be
   used 8 hours a day at a rental-agency counter.
   ============================================================ */

:root {
    /* Palette — slate background, blue accent, semantic colors */
    --c-bg:           #F8FAFC;   /* page background */
    --c-surface:      #FFFFFF;   /* cards, content panels */
    --c-surface-2:    #F1F5F9;   /* hover backgrounds, subtle stripes */
    --c-border:       #E2E8F0;   /* default borders */
    --c-border-strong:#CBD5E1;

    --c-text:         #0F172A;   /* primary text */
    --c-text-muted:   #64748B;   /* secondary text */
    --c-text-faint:   #94A3B8;   /* tertiary */

    --c-primary:      #EF9E05;   /* brand / actions */
    --c-primary-hover:#C78305;
    --c-primary-soft: #FEEDCD;

    --c-success:      #16A34A;
    --c-warning:      #D97706;
    --c-danger:       #DC2626;
    --c-info:         #0891B2;

    /* Sidebar — near-black */
    --c-side-bg:      #100F0F;
    --c-side-bg-2:    #1D1C1B;
    --c-side-text:    #E2E8F0;
    --c-side-muted:   #94A3B8;
    --c-side-active:  #FAA02E;

    /* Sizing */
    --sidebar-w:      260px;
    --topbar-h:       60px;
    --radius:         8px;
    --radius-sm:      6px;

    /* Shadows */
    --shadow-sm:      0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow:         0 2px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);

    /* Typography */
    --font-sans:      'Inter', 'Poppins', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
    --font-ar:        'Cairo', 'Amiri', system-ui, sans-serif;
}

/* ----- Reset & base ------------------------------------------------- */

html, body {
    height: 100%;
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.is-rtl {
    font-family: var(--font-ar);
}

a {
    color: var(--c-primary);
    text-decoration: none;
}
a:hover { color: var(--c-primary-hover); }

h1, h2, h3, h4, h5, h6 {
    color: var(--c-text);
    font-weight: 600;
    margin: 0 0 0.5rem;
}

/* ============================================================
   App shell with sidebar + topbar
   ============================================================ */

body.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-w);
    background: var(--c-side-bg);
    color: var(--c-side-text);
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--sidebar-w);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;            /* allow tables to scroll inside */
    display: flex;
    flex-direction: column;
}

/* Sidebar — brand */
.app-sidebar .brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--c-side-bg-2);
}
.app-sidebar .brand-link,
.app-topbar .brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
}
.app-sidebar .brand-link { color: var(--c-side-text); }
.app-topbar .brand-link  { color: var(--c-text); }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 13px;
}
.brand-name {
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Sidebar — nav */
.side-nav {
    padding: 0.5rem 0;
    flex: 1 1 auto;
}
.side-section {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-side-muted);
    font-weight: 600;
}
.side-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.side-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    color: var(--c-side-text);
    text-decoration: none;
    border-inline-start: 3px solid transparent;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.side-link:hover {
    background: var(--c-side-bg-2);
    color: #fff;
}
.side-link.active {
    background: var(--c-side-bg-2);
    color: #fff;
    border-inline-start-color: var(--c-side-active);
}
.side-link i { width: 18px; text-align: center; opacity: 0.9; }

.side-footer {
    padding: 1rem 1.25rem;
    color: var(--c-side-muted);
    border-top: 1px solid var(--c-side-bg-2);
}

/* Topbar */
.app-topbar {
    height: var(--topbar-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-topbar .page-title {
    font-weight: 600;
    color: var(--c-text);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--c-text);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    text-decoration: none;
}
.topbar-btn:hover {
    background: var(--c-surface-2);
    border-color: var(--c-border);
}
.topbar-btn.primary {
    background: var(--c-primary);
    color: #fff;
}
.topbar-btn.primary:hover { background: var(--c-primary-hover); border-color: transparent; color: #fff; }

.user-btn { gap: 0.6rem; }
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--c-primary-soft);
    color: var(--c-primary-hover);
    font-weight: 600;
    font-size: 12px;
}
.user-name { color: var(--c-text-muted); }

/* Content area */
.app-content {
    padding: 1.5rem 2rem;
    flex: 1 1 auto;
}

/* ============================================================
   Auth shell (login / forgot / reset)
   ============================================================ */

body.auth-shell {
    background: linear-gradient(180deg, #F1F5F9 0%, #E2E8F0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-main {
    width: 100%;
    max-width: 460px;
    padding: 1.5rem;
}
.auth-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}
.auth-card .account-title,
.auth-card h1 {
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
}
.auth-card .account-subtitle {
    color: var(--c-text-muted);
    margin-bottom: 1.25rem;
}
.auth-footer,
.auth-langs {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 13px;
}
.auth-langs .sep { margin: 0 0.5rem; color: var(--c-text-faint); }
.auth-lang { color: var(--c-text-muted); }
.auth-lang.active { color: var(--c-primary); font-weight: 600; }
.btn-account { width: 100%; }

/* ============================================================
   Cards, panels, tables (Bootstrap overrides)
   ============================================================ */

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 0.85rem 1rem;
    font-weight: 600;
}
.card-body { padding: 1rem; }

.table {
    --bs-table-bg: transparent;
    color: var(--c-text);
    margin-bottom: 0;
}
.table > :not(caption) > * > * {
    padding: 0.65rem 0.75rem;
    border-bottom-color: var(--c-border);
}
.table thead th {
    background: var(--c-surface-2);
    color: var(--c-text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
    font-weight: 600;
    border-bottom: 1px solid var(--c-border);
}
.table-hover > tbody > tr:hover > * {
    background: var(--c-surface-2);
}

/* Forms */
.form-control,
.form-select {
    border-color: var(--c-border);
    color: var(--c-text);
    border-radius: var(--radius-sm);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(239, 158, 5, 0.15);
}
.form-label { color: var(--c-text-muted); font-weight: 500; font-size: 13px; margin-bottom: 0.35rem; }
.form-text  { color: var(--c-text-faint); font-size: 12px; }

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 0.45rem 0.95rem;
}
.btn-primary {
    background: var(--c-primary);
    border-color: var(--c-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--c-primary-hover);
    border-color: var(--c-primary-hover);
}
.btn-outline-primary {
    color: var(--c-primary);
    border-color: var(--c-primary);
}
.btn-outline-primary:hover {
    background: var(--c-primary);
    color: #fff;
}
.btn-outline-secondary {
    color: var(--c-text-muted);
    border-color: var(--c-border-strong);
}
.btn-outline-secondary:hover {
    background: var(--c-surface-2);
    color: var(--c-text);
}
.btn-success { background: var(--c-success); border-color: var(--c-success); }
.btn-danger  { background: var(--c-danger);  border-color: var(--c-danger); }
.btn-warning { background: var(--c-warning); border-color: var(--c-warning); color: #fff; }

/* Badges */
.badge {
    font-weight: 500;
    border-radius: 999px;
    padding: 0.3em 0.7em;
}

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 0.7rem 1rem;
}
.alert-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.alert-danger  { background: #FEF2F2; border-color: #FCA5A5; color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-info    { background: #ECFEFF; border-color: #A5F3FC; color: #155E75; }

/* Dropdown menus */
.dropdown-menu {
    border-color: var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.35rem;
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    color: var(--c-text);
}
.dropdown-item:hover {
    background: var(--c-surface-2);
    color: var(--c-text);
}

/* Page header pattern: <h2> + actions */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.page-head h1, .page-head h2 { margin: 0; font-size: 1.35rem; }
.page-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Subtle muted text helper */
.muted { color: var(--c-text-muted); }

/* Stat card pattern used by dashboards */
.stat-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.stat-card .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-text-muted);
}
.stat-card .value {
    font-size: 1.6rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Logout form inside dropdown — no button styling */
.logout-form > button {
    background: transparent;
    border: 0;
    text-align: start;
    width: 100%;
}

/* ============================================================
   RTL adjustments
   ------------------------------------------------------------
   Most spacing uses logical properties (margin-inline-*) so
   automatic. Only a few cosmetic tweaks here.
   ============================================================ */

body.is-rtl .me-2 { margin-inline-end: 0.5rem !important; }

/* ============================================================
   Responsive: stack sidebar on small screens
   ============================================================ */

@media (max-width: 992px) {
    body.app-shell { flex-direction: column; }
    .app-sidebar {
        position: static;
        width: 100%;
        height: auto;
        flex: 0 0 auto;
    }
    .app-content { padding: 1rem; }
}
