/* ==========================================================
   HOTEL & TRANSFER MANAGEMENT PRO — App stylesheet
   ========================================================== */
:root {
    --app-primary: #2563eb;
    --app-primary-rgb: 37, 99, 235;
    --app-primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-bg-2: #111c34;
    --sidebar-text: #94a3b8;
    --sidebar-active: #2563eb;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
}

[data-bs-theme="dark"] {
    --bg: #0b1120;
    --card-bg: #111a2e;
    --border: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* ---------------- Layout shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1040;
    transition: transform .25s ease;
}

[dir="rtl"] .app-sidebar { left: auto; right: 0; }

.sidebar-brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.1rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.brand-logo-fallback {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.2rem;
}
.brand-text { line-height: 1.15; overflow: hidden; }
.brand-name { display: block; color: #fff; font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .66rem; opacity: .7; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-close { color: #94a3b8 !important; padding: 0 .2rem; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .6rem .75rem 1rem; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-section {
    font-size: .64rem; text-transform: uppercase; letter-spacing: .12em;
    color: rgba(148,163,184,.6); padding: 1rem .6rem .4rem;
}
.nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .58rem .75rem; margin-bottom: 2px;
    border-radius: .55rem; color: var(--sidebar-text);
    font-size: .9rem; text-decoration: none; transition: all .15s ease;
    border-inline-start: 3px solid transparent;
}
.nav-link i { width: 20px; text-align: center; font-size: .95rem; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(var(--app-primary-rgb), .9), rgba(var(--app-primary-rgb), .55));
    border-inline-start-color: #fff;
    box-shadow: 0 4px 14px rgba(var(--app-primary-rgb), .35);
}
[dir="rtl"] .nav-link.active { border-inline-start-color: transparent; border-inline-end-color: #fff; }

.sidebar-footer {
    padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.06); font-size: .8rem;
}

.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1035;
}

/* ---------------- Main ---------------- */
.app-main {
    flex: 1; min-width: 0;
    margin-inline-start: 260px;
    display: flex; flex-direction: column; min-height: 100vh;
}

.app-topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem 1.25rem;
    background: color-mix(in srgb, var(--card-bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-title h1 { font-size: 1.05rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: .35rem; }

.btn-icon {
    width: 40px; height: 40px; border-radius: .6rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; color: var(--text);
}
.btn-icon:hover { background: rgba(var(--app-primary-rgb), .08); color: var(--app-primary); }

.badge-notif {
    position: absolute; top: 4px; right: 6px;
    background: #ef4444; color: #fff; font-size: .6rem;
    border-radius: 10px; padding: 1px 5px; line-height: 1.3;
}
[dir="rtl"] .badge-notif { right: auto; left: 6px; }

.btn-user {
    display: flex; align-items: center; gap: .55rem;
    background: transparent; border: 1px solid var(--border); border-radius: 2rem;
    padding: .28rem .8rem .28rem .28rem; color: var(--text);
}
[dir="rtl"] .btn-user { padding: .28rem .28rem .28rem .8rem; }
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
    background: linear-gradient(135deg, var(--app-primary), #8b5cf6);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; text-transform: uppercase;
}

.app-content { flex: 1; }
.app-footer {
    padding: .9rem 1.25rem; font-size: .75rem; color: var(--muted);
    border-top: 1px solid var(--border); text-align: center;
}

/* ---------------- Cards & stat cards ---------------- */
.app-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: .9rem;
    box-shadow: 0 1px 3px rgba(15,23,42,.05);
    overflow: hidden;
}
.app-card .card-header {
    background: transparent; border-bottom: 1px solid var(--border);
    padding: .85rem 1.1rem; font-weight: 600; font-size: .92rem;
}
.app-card .card-body { padding: 1.1rem; }
.app-card .card-footer { background: transparent; border-top: 1px solid var(--border); }

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: .9rem;
    padding: 1rem 1.1rem;
    display: flex; align-items: center; gap: .9rem;
    box-shadow: 0 1px 3px rgba(15,23,42,.05);
    transition: transform .15s ease, box-shadow .15s ease;
    height: 100%;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,23,42,.08); }
.stat-icon {
    width: 48px; height: 48px; border-radius: .85rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.stat-info { display: flex; flex-direction: column; min-width: 0; }
.stat-info span { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-info strong { font-size: 1.25rem; font-weight: 800; }

/* ---------------- Tables ---------------- */
.app-table { --bs-table-bg: transparent; }
.app-table thead th {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); background: color-mix(in srgb, var(--card-bg) 97%, #000); 
    border-bottom: 1px solid var(--border); padding: .65rem .8rem; white-space: nowrap;
}
.app-table tbody td { padding: .6rem .8rem; font-size: .87rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.app-table tbody tr:hover { background: rgba(var(--app-primary-rgb), .04); }
[data-bs-theme="dark"] .app-table thead th { background: #0d1526; }

/* ---------------- Buttons ---------------- */
.btn-app {
    background: var(--app-primary); border-color: var(--app-primary); color: #fff;
    border-radius: .55rem; font-weight: 600;
}
.btn-app:hover, .btn-app:focus { background: var(--app-primary-dark); border-color: var(--app-primary-dark); color: #fff; }

.btn-icon-soft {
    width: 32px; height: 32px; border-radius: .5rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--app-primary-rgb), .08); color: var(--app-primary);
    border: none; padding: 0;
}
.btn-icon-soft:hover { background: rgba(var(--app-primary-rgb), .16); }

/* ---------------- Badges ---------------- */
.badge.text-bg-soft-primary { background: rgba(var(--app-primary-rgb), .12); color: var(--app-primary); }

/* ---------------- Forms ---------------- */
.form-control, .form-select {
    border-radius: .55rem; background: var(--card-bg); border-color: var(--border);
}
.form-control:focus, .form-select:focus {
    border-color: var(--app-primary); box-shadow: 0 0 0 .2rem rgba(var(--app-primary-rgb), .15);
}

/* ---------------- Auth ---------------- */
.auth-body {
    background: radial-gradient(1200px 600px at 20% -10%, rgba(var(--app-primary-rgb), .25), transparent 60%),
                radial-gradient(1000px 500px at 110% 110%, rgba(168,85,247,.18), transparent 60%),
                #0f172a;
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem;
}
.auth-wrap { width: 100%; max-width: 460px; }
.auth-card { border-radius: 1.25rem; overflow: hidden; }
.auth-logo {
    width: 64px; height: 64px; border-radius: 1rem; font-size: 1.6rem;
    background: linear-gradient(135deg, var(--app-primary), #8b5cf6);
    color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}

/* ---------------- Notifications ---------------- */
.notif-menu { width: 320px; padding: 0; overflow: hidden; }
.notif-head { padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item {
    display: flex; gap: .6rem; padding: .6rem .9rem; text-decoration: none; color: var(--text);
    border-bottom: 1px solid var(--border); align-items: flex-start;
}
.notif-item:hover { background: rgba(var(--app-primary-rgb), .06); }
.notif-item.unread { background: rgba(var(--app-primary-rgb), .07); }
.notif-icon { color: var(--app-primary); margin-top: 2px; }
.notif-avatar {
    width: 36px; height: 36px; border-radius: .7rem; flex-shrink: 0;
    background: rgba(var(--app-primary-rgb), .12); color: var(--app-primary);
    display: flex; align-items: center; justify-content: center;
}
.notif-unread { background: rgba(var(--app-primary-rgb), .05); }

/* ---------------- Import / OCR ---------------- */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 2.5rem 1rem;
    text-align: center;
    transition: all .2s ease;
    cursor: pointer;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--app-primary);
    background: rgba(var(--app-primary-rgb), .05);
}
.drop-icon { font-size: 3rem; color: var(--app-primary); opacity: .6; margin-bottom: .6rem; }
.ocr-preview { max-height: 140px; border-radius: .6rem; }

.driver-photo { width: 38px; height: 38px; border-radius: .6rem; object-fit: cover; }
.driver-photo-empty {
    background: rgba(var(--app-primary-rgb), .1); color: var(--app-primary);
    display: inline-flex; align-items: center; justify-content: center;
}

/* ---------------- Reports ---------------- */
.nav-report { gap: .25rem; }
.nav-report .nav-link { color: var(--muted); border-radius: .55rem; font-size: .85rem; }
.nav-report .nav-link.active { background: var(--app-primary); color: #fff; }
.report-body { background: var(--card-bg); border: 1px solid var(--border); border-radius: .8rem; padding: 1.25rem; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.summary-box {
    background: rgba(var(--app-primary-rgb), .07);
    border: 1px solid rgba(var(--app-primary-rgb), .2);
    border-radius: .7rem; padding: .8rem 1rem; font-weight: 600; font-size: .9rem;
}

/* ---------------- Pagination ---------------- */
.pagination .page-link { border-radius: .45rem; margin: 0 2px; color: var(--text); border-color: var(--border); background: var(--card-bg); }
.pagination .page-item.active .page-link { background: var(--app-primary); border-color: var(--app-primary); }

/* ---------------- Misc ---------------- */
.bg-soft-primary { background: rgba(var(--app-primary-rgb), .08); }
.status-flash { box-shadow: 0 0 0 .2rem rgba(16,185,129,.35) !important; border-color: #10b981 !important; }
.user-avatar-large {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, var(--app-primary), #8b5cf6);
    color: #fff; font-size: 2rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    text-transform: uppercase;
}

/* ---------------- Print ---------------- */
@media print {
    .app-sidebar, .app-topbar, .app-footer, .no-print, .sidebar-overlay { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff; }
    .report-body { border: none; padding: 0; }
    .report-filters, .nav-report { display: none !important; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    [dir="rtl"] .app-sidebar { transform: translateX(100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-inline-start: 0; }
    .sidebar-overlay.show { display: block; }
    .topbar-title { display: none; }
}

@media (min-width: 992px) {
    .app-sidebar { transform: none !important; }
}