/* ==========================================================================
   Bahrain Central Car Rental Blacklist Registry - High-Contrast & RTL System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette - High-Contrast Executive Light Theme */
    --bg-dark: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f1f5f9;
    --border-color: #cbd5e1; /* Crisp, distinct border lines */
    --border-highlight: rgba(158, 27, 50, 0.3);

    /* Brand Accent Colors */
    --primary: #9E1B32; /* Bahrain Crimson */
    --primary-hover: #801427;
    --primary-light: rgba(158, 27, 50, 0.08);
    --primary-gradient: linear-gradient(135deg, #9E1B32 0%, #c41e3a 100%);
    --accent-gold: #b45309;

    /* Status Colors */
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --success: #047857;
    --success-bg: #ecfdf5;
    --info: #1d4ed8;
    --info-bg: #eff6ff;

    /* Text Colors - High Contrast AAA Standards */
    --text-main: #0f172a;  /* Deep Slate 900 - Dark Black Text */
    --text-muted: #334155; /* Slate 700 - Highly Visible Dark Text */
    --text-dim: #475569;   /* Slate 600 - Secondary Crisp Text */

    /* Spacing & Elevation Shadows */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 20px 30px -10px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 25px 50px -12px rgba(158, 27, 50, 0.15);

    --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-arabic: 'Tajawal', 'Plus Jakarta Sans', sans-serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* RTL Language Rules */
html[dir="rtl"] body {
    font-family: var(--font-arabic);
    text-align: right;
}

html[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
    border-right: none;
    border-left: 1px solid var(--border-color);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.04);
}

html[dir="rtl"] .main-wrapper {
    margin-left: 0;
    margin-right: 280px;
}

html[dir="rtl"] .nav-item {
    transform-origin: right;
}

html[dir="rtl"] .nav-item:hover {
    transform: translateX(-4px);
}

html[dir="rtl"] .topbar-search i {
    left: auto;
    right: 1.1rem;
}

html[dir="rtl"] .topbar-search input {
    padding: 0.65rem 2.75rem 0.65rem 1rem;
}

html[dir="rtl"] .custom-table {
    text-align: right;
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-slide-up {
    animation: slideUp 0.4s var(--ease-out) forwards;
}

/* App Layout */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.25rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.brand-title h1 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.brand-title span {
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.09em;
    margin: 1.1rem 0 0.4rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: all 0.25s var(--ease-out);
}

.nav-item i {
    font-size: 1.2rem;
    transition: transform 0.25s var(--ease-out);
}

.nav-item:hover {
    color: var(--primary);
    background: #f1f5f9;
    transform: translateX(4px);
}

.nav-item:hover i {
    transform: scale(1.15);
}

.nav-item.active {
    color: #fff;
    background: var(--primary-gradient);
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(158, 27, 50, 0.28);
    transform: translateX(0);
}

.nav-item.active i {
    color: #fff;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 800;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(4, 120, 87, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(4, 120, 87, 0); }
}

/* Main Content Area */
.main-wrapper {
    margin-left: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: 72px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.25rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-search {
    width: 440px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1rem 0.65rem 2.75rem;
    border-radius: var(--radius-full);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    transition: all 0.25s var(--ease-out);
}

.topbar-search input:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(158, 27, 50, 0.12);
}

.topbar-search i {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1.1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.badge-country {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--primary-light);
    border: 1px solid rgba(158, 27, 50, 0.2);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
}

.lang-switch-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 800;
    color: #0f172a;
    text-decoration: none;
    transition: all 0.2s ease;
}

.lang-switch-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.content-body {
    padding: 2.25rem;
    flex: 1;
}

/* Page Headers */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.page-title h2 {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.page-title p {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.2rem;
}

/* Metric Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.35rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.6rem;
    display: flex;
    align-items: center;
    gap: 1.35rem;
    box-shadow: var(--shadow-card);
    transition: all 0.3s var(--ease-out);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(158, 27, 50, 0.3);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    flex-shrink: 0;
    transition: transform 0.3s var(--ease-out);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.stat-icon.red { background: #fef2f2; color: #dc2626; border: 1px solid rgba(220,38,38,0.25); }
.stat-icon.gold { background: #fffbeb; color: #b45309; border: 1px solid rgba(217,119,6,0.25); }
.stat-icon.blue { background: #eff6ff; color: #1d4ed8; border: 1px solid rgba(37,99,235,0.25); }
.stat-icon.emerald { background: #ecfdf5; color: #047857; border: 1px solid rgba(5,150,105,0.25); }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.stat-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
}

/* Tables & Card Panels */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.6rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.3s var(--ease-out);
}

.card-panel:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
}

.card-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.35rem;
}

.card-title-bar h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.custom-table th {
    padding: 0.95rem 1.1rem;
    color: #0f172a;
    font-weight: 800;
    border-bottom: 2px solid #cbd5e1;
    background: #f1f5f9;
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.07em;
}

.custom-table td {
    padding: 1.1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
    font-size: 0.88rem;
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: background 0.18s var(--ease-out);
}

.custom-table tbody tr:hover {
    background: #f8fafc;
}

/* Badges & Status */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.badge-high { background: #fef2f2; color: #9E1B32; border: 1px solid rgba(158, 27, 50, 0.3); font-weight: 800; }
.badge-medium { background: #fffbeb; color: #b45309; border: 1px solid rgba(217, 119, 6, 0.3); font-weight: 800; }
.badge-low { background: #eff6ff; color: #1d4ed8; border: 1px solid rgba(37, 99, 235, 0.3); font-weight: 800; }
.badge-secondary { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; font-weight: 700; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 800;
}

.status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-verified { color: #047857; }
.status-verified .dot { background: #047857; box-shadow: 0 0 6px rgba(4, 120, 87, 0.4); }

.status-disputed { color: #b45309; }
.status-disputed .dot { background: #b45309; box-shadow: 0 0 6px rgba(180, 83, 9, 0.4); }

.status-resolved { color: #475569; }
.status-resolved .dot { background: #475569; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.68rem 1.35rem;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    transition: all 0.25s var(--ease-out);
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(158, 27, 50, 0.28);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b81f3b 0%, #801427 100%);
    box-shadow: 0 8px 20px rgba(158, 27, 50, 0.38);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* Form Controls */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.35rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-muted);
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.05rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: all 0.25s var(--ease-out);
}

.form-control:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(158, 27, 50, 0.12);
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

/* Code Snippet Blocks */
.code-block {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: var(--radius-md);
    padding: 1.35rem;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    overflow-x: auto;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.code-copy-btn {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #f8fafc;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 800;
    transition: all 0.2s ease;
}

.code-copy-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.28);
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s var(--ease-out);
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 660px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-glow);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s var(--ease-out);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.35rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.35rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover { color: var(--text-main); }

/* Responsive adjustments */
@media (max-width: 992px) {
    .sidebar { width: 80px; padding: 1rem 0.5rem; }
    .brand-title, .nav-item span, .nav-label, .sidebar-footer { display: none; }
    .main-wrapper { margin-left: 80px; }
    .topbar-search { width: 250px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: span 1; }
}
