/* ============================================================
   JAGUAR ERP — UNIFIED DESIGN SYSTEM (V3.0)
   Single source of truth for the whole application.
   Brand: Gold #C5A028 on Deep Slate #0F172A — Font: Tajawal
   Rules:
   - ONE definition per component (no duplicates).
   - Colors only via tokens.
   - Logical properties (inline-start/end) for RTL/LTR safety.
   - !important ONLY to override Bootstrap defaults.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

/* ===== 1. DESIGN TOKENS ===== */
:root {
    /* Brand — the single gold used everywhere */
    --brand-gold: #C5A028;
    --brand-gold-light: #D4AF37;
    --brand-gold-dark: #A6830C;
    --brand-gold-gradient: linear-gradient(135deg, #A6830C 0%, #C5A028 50%, #8E6F0A 100%);
    --gold-tint-08: rgba(197, 160, 40, 0.08);
    --gold-tint-12: rgba(212, 175, 55, 0.14);
    --gold-focus-ring: rgba(197, 160, 40, 0.20);

    /* Slate */
    --brand-slate: #1E293B;
    --brand-slate-light: #334155;
    --brand-slate-dark: #0F172A;
    --brand-slate-extra-dark: #020617;

    /* Neutrals */
    --white: #FFFFFF;
    --bg-light: #F8FAFC;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Status */
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-gold: 0 4px 15px rgba(197, 160, 40, 0.30);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Typography */
    --font-base: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    --size-xs: 0.75rem;
    --size-sm: 0.875rem;
    --size-base: 1rem;
    --size-lg: 1.125rem;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* ===== 2. BASE & RESET ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-base);
    background-color: var(--bg-light);
    color: var(--gray-800);
    font-size: var(--size-sm);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* The sidebar is docked to the inline-start edge: right in Arabic, left in English.
   These tokens keep every sidebar rule direction-agnostic — no [dir] selector needed. */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
    --sidebar-hide-x: 100%;            /* push the sidebar off-screen, outward */
    --sidebar-shadow: -4px 0 10px rgba(0, 0, 0, 0.2);
    --sidebar-gradient-to: to right;   /* keep the light edge next to the icon */
}

[dir="ltr"] {
    direction: ltr;
    text-align: left;
    --sidebar-hide-x: -100%;
    --sidebar-shadow: 4px 0 10px rgba(0, 0, 0, 0.2);
    --sidebar-gradient-to: to left;
}

::selection {
    background: var(--brand-gold);
    color: var(--brand-slate-dark);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-gold); }

a { color: var(--brand-gold-dark); }
a:hover { color: var(--brand-gold); }

hr { border-color: var(--gray-200); opacity: 1; }

/* Focus ring — consistent gold across all interactive elements */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.page-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.2rem var(--gold-focus-ring) !important;
}

/* ===== 3. HEADER ===== */
.main-header {
    height: var(--header-height);
    background: var(--brand-slate-dark);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    border-bottom: 2px solid var(--brand-gold);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

/* Small phones: drop the wordmark so the sidebar toggle + header actions still fit */
@media (max-width: 575px) {
    .logo-text { display: none; }
    .logo-section { gap: 0.5rem; }
}

.jaguar-logo {
    height: 45px;
    width: auto;
    filter: drop-shadow(0 0 5px rgba(197, 160, 40, 0.5));
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-gold);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.system-subtitle {
    font-size: 0.7rem;
    color: var(--brand-gold-light);
    font-weight: 500;
    opacity: 0.85;
}

.user-profile-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--brand-gold);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    transition: background 0.2s ease, color 0.2s ease;
}

.user-profile-btn:hover {
    background: var(--brand-gold);
    color: var(--brand-slate-dark);
}

/* Single-arrow profile toggle (Bootstrap caret suppressed, chevron rotates) */
.user-profile-btn::after { display: none !important; }

.user-chevron {
    transition: transform 0.25s ease;
}

.user-profile-btn[aria-expanded="true"] .user-chevron {
    transform: rotate(180deg);
}

/* Profile dropdown menu */
.user-menu {
    min-width: 260px;
    padding: 0.5rem;
    border: 1px solid rgba(197, 160, 40, 0.25);
    border-radius: var(--radius-md);
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    background: var(--gold-tint-08);
    border-radius: var(--radius-sm);
}

.user-avatar-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand-gold-gradient);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-menu-meta {
    min-width: 0;
}

.user-menu-meta strong {
    color: var(--brand-slate-dark);
    font-weight: 700;
    font-size: var(--size-sm);
}

.user-menu-meta small {
    color: var(--gray-500);
    font-size: var(--size-xs);
}

.user-menu-label {
    padding: 0.5rem 0.9rem 0.25rem;
    font-size: var(--size-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--brand-gold-dark);
}

/* Letter-spacing only for Latin (LTR) — breaks Arabic script */
[dir="ltr"] .user-menu-label {
    letter-spacing: 0.08em;
}

.user-menu .dropdown-divider {
    border-color: var(--gray-200);
    opacity: 1;
    margin: 0.45rem 0.25rem;
}

.user-menu .dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: background 0.15s ease, color 0.15s ease;
}

.user-menu .dropdown-item:hover {
    background: var(--gold-tint-08);
    color: var(--brand-slate-dark);
}

.user-menu .dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--error);
}

/* Language segmented toggle */
.user-menu .lang-toggle .btn {
    border-radius: var(--radius-sm) !important;
    font-weight: 600;
}

.user-menu .lang-toggle .btn.btn-primary {
    background: var(--brand-gold);
    border-color: var(--brand-gold);
    color: var(--brand-slate-dark);
}

.user-menu .lang-toggle .btn.btn-outline-primary {
    color: var(--brand-gold-dark);
    border-color: var(--brand-gold);
}

.user-menu .lang-toggle .btn.btn-outline-primary:hover {
    background: var(--gold-tint-08);
    color: var(--brand-gold-dark);
}

/* RTL icon flip utility for directional icons */
[dir="rtl"] .icon-flip {
    transform: scaleX(-1);
    display: inline-block;
}

/* Profile link hover fallback (inline styled elements) */
.user-menu a.dropdown-item:hover {
    background: var(--gold-tint-08);
    color: var(--brand-slate-dark) !important;
    text-decoration: none !important;
}

#sidebar-toggle {
    color: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Pull the glyph out to the header edge and hold it off the logo */
    margin-inline-start: -0.5rem;
    margin-inline-end: 0.25rem;
    transition: background 0.2s ease, border-radius 0.2s ease;
}

#sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
}

/* Icon glyph alignment inside the header button */
#sidebar-toggle .bi {
    line-height: 1;
    transition: opacity 0.2s ease;
}

/* Sidebar collapsed / offcanvas-closed: same hamburger, dimmed */
#sidebar-toggle.is-off .bi {
    opacity: 0.4;
}

/* ===== 4. SIDEBAR ===== */
/* Docked to the inline-start edge via logical properties, so Arabic puts it on the
   right and English on the left with no per-direction overrides. */
.sidebar {
    width: var(--sidebar-width);
    background: #111827;
    height: 100vh;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: auto;
    padding-top: var(--header-height);
    transition: transform 0.3s ease;
    z-index: 900;
    box-shadow: var(--sidebar-shadow);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Desktop: docked and visible by default; html.sidebar-collapsed slides it off-screen. */
@media (min-width: 992px) {
    html.sidebar-collapsed .sidebar {
        transform: translateX(var(--sidebar-hide-x));
    }
}

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 0;
    margin: 0;
}

.sidebar-menu li { margin-bottom: 0.25rem; }

.sidebar-menu a,
.section-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: #ffffff;
    text-decoration: none;
    transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease;
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    /* Pill shape — rounded on the inline-end (content) side, with a matching gutter */
    border-radius: 0 50px 50px 0;
    margin-inline-end: 1rem;
}

.menu-icon {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    color: var(--brand-gold);
    flex-shrink: 0;
}

.sidebar-menu a:hover,
.section-toggle:hover {
    background: linear-gradient(var(--sidebar-gradient-to), #8B6914 0%, #C5A028 100%);
    color: #ffffff !important;
}

.sidebar-menu a:hover .menu-icon,
.section-toggle:hover .menu-icon {
    color: #ffffff !important;
}

/* Active link — gold pill + start-edge accent bar */
.sidebar-menu a.active {
    background: linear-gradient(var(--sidebar-gradient-to), #b08d26 0%, #d4af37 100%) !important;
    color: #000000 !important;
    font-weight: 700;
    border-inline-start: 3px solid var(--brand-gold-light);
}

.sidebar-menu a.active .menu-icon {
    color: #000000 !important;
}

/* Home item — always gold */
.menu-item-gold {
    background: linear-gradient(var(--sidebar-gradient-to), #b08d26 0%, #d4af37 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.menu-item-gold .menu-icon {
    color: #ffffff !important;
}

/* Section toggles (group headers) */
.sidebar-section { margin-top: 0.15rem; }

.section-toggle {
    padding-top: 1rem;
    padding-bottom: 1rem;
    color: #f1f5f9;
}

.section-toggle .menu-icon { color: var(--brand-gold-dark); }

.section-toggle.active-section {
    background: var(--gold-tint-12) !important;
    color: var(--brand-gold-light) !important;
}

.toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    opacity: 0.5;
    margin-inline-start: auto;
}

.submenu {
    list-style: none;
    margin: 0.25rem 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.18);
}

.submenu a {
    padding: 0.65rem 2rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
}

.submenu a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.submenu .dropdown-divider { border-color: rgba(255,255,255,0.12); }

/* Mobile overlay backdrop */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    z-index: 850;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== 5. LAYOUT ===== */
.layout-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    padding-top: var(--header-height);
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 2rem;
    transition: margin-inline-start 0.3s ease;
    min-width: 0;
}

/* Footer */
.main-footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    color: var(--gray-500);
    margin-top: auto;
    transition: margin-inline-start 0.3s ease;
}

/* Desktop: sidebar is docked, content is inset by its width.
   Collapsed (html.sidebar-collapsed) drops the inset so pages take the full screen. */
@media (min-width: 992px) {
    .main-content { margin-inline-start: var(--sidebar-width) !important; }
    .main-footer { margin-inline-start: var(--sidebar-width); }

    html.sidebar-collapsed .main-content { margin-inline-start: 0 !important; }
    html.sidebar-collapsed .main-footer { margin-inline-start: 0; }
}

/* Mobile/tablet: sidebar is an offcanvas panel, so content is never inset. */
@media (max-width: 991px) {
    .sidebar { transform: translateX(var(--sidebar-hide-x)); }
    .sidebar.active { transform: translateX(0); }

    .main-content { margin-inline-start: 0 !important; }
    .main-footer { margin-inline-start: 0; }

    .main-content { padding: 1.25rem; }
}

/* ===== 6. PAGE HEADER COMPONENTS ===== */
.page-header,
.jaguar-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title-wrapper,
.jaguar-page-title-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.page-title,
.jaguar-page-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--brand-slate-dark);
    margin: 0;
    line-height: 1.3;
}

.page-subtitle,
.jaguar-page-subtitle {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.page-actions,
.jaguar-page-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== 7. CARDS & STATS ===== */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 700;
    color: var(--brand-slate-dark);
    padding: 1rem 1.25rem;
}

.card-body { padding: 1.25rem; }

.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    border-top: 4px solid var(--brand-gold);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    color: var(--gray-500);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-slate-dark);
    line-height: 1;
}

/* Modern KPI card variant (dashboard) */
.stat-card-modern {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-modern:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: rgba(15, 23, 42, 0.1);
    color: var(--brand-slate-dark);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.gold {
    background: var(--gold-tint-12);
    color: var(--brand-gold);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* ===== 8. TABLES — single source of truth ===== */
.table-responsive {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border: 1px solid var(--gray-200);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    color: var(--gray-700);
}

.table th {
    background: var(--brand-slate-dark);
    color: var(--brand-gold-light);
    padding: 0.85rem 1rem;
    font-weight: 700;
    text-align: inherit;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 2px solid var(--brand-gold);
    vertical-align: middle;
}

.table td {
    padding: 0.72rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    font-weight: 500;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:nth-of-type(even) {
    background-color: rgba(15, 23, 42, 0.02);
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--gold-tint-08);
}

/* Serial-number first column — only inside real data grids
   (tables wrapped in .table-responsive). Soft gold chip style. */
.table-responsive > .table td:first-child {
    background-color: var(--gold-tint-12);
    color: var(--brand-slate-dark);
    font-weight: 700;
    text-align: center;
    min-width: 48px;
    width: 52px;
    border-inline-end: 1px solid var(--gray-200);
}

/* Dark variant (kept for legacy templates) */
.table-dark {
    --bs-table-bg: var(--brand-slate-dark) !important;
    --bs-table-color: var(--brand-gold-light) !important;
}

.table-sm td, .table-sm th { padding: 0.45rem 0.6rem; }

/* Row action buttons inside tables */
.table .btn { white-space: nowrap; }
.table .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }

/* ===== 9. BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-size: 0.85rem;
    text-decoration: none;
    font-family: var(--font-base);
}

.btn-primary,
.btn-primary:active,
.btn-primary:focus {
    background: var(--brand-gold-gradient) !important;
    color: var(--brand-slate-dark) !important;
    border: none !important;
    box-shadow: var(--shadow-gold) !important;
}

.btn-primary:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 1px solid var(--brand-gold) !important;
    color: var(--brand-gold-dark) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background: var(--brand-gold) !important;
    color: var(--white) !important;
}

.btn-danger {
    background: var(--error) !important;
    color: white !important;
    border: none !important;
}

/* Graceful fallback for legacy invalid "btn-outline" usage */
.btn.btn-outline {
    border: 1px solid var(--gray-300) !important;
    color: var(--gray-600) !important;
    background: transparent !important;
}

.btn.btn-outline:hover {
    background: var(--gray-100) !important;
    color: var(--gray-800) !important;
}

/* ===== 10. FORMS ===== */
.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.35rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 0.2rem var(--gold-focus-ring);
}

.form-check-input:checked {
    background-color: var(--brand-gold);
    border-color: var(--brand-gold);
}

.input-group-text {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-600);
}

/* Select2 alignment with theme */
.select2-container .select2-selection--single {
    height: 38px;
    display: flex;
    align-items: center;
}

/* Keep the select2 results dropdown UNDER the fixed navbar instead of
   floating above it (navbar z-index is 1000, select2 default is 1056). */
.select2-dropdown,
.select2-container--bootstrap-5 .select2-dropdown {
    z-index: 850 !important;
}

/* ===== 11. BADGES ===== */
.badge {
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-error   { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #DBEAFE; color: #1E40AF; }

/* ===== 12. FILTERS ===== */
.filter-section {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
    align-items: end;
}

/* ===== 13. PAGINATION ===== */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    gap: 0.3rem;
    margin: 0;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.8rem;
    color: var(--gray-700);
    text-decoration: none;
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 38px;
    text-align: center;
}

.page-link:hover {
    z-index: 2;
    color: var(--brand-slate-dark);
    background-color: var(--gray-100);
    border-color: var(--brand-gold);
}

.page-item.active .page-link {
    z-index: 3;
    color: var(--brand-slate-dark);
    background: var(--brand-gold-gradient);
    border-color: var(--brand-gold);
}

.page-item.disabled .page-link {
    color: var(--gray-400);
    pointer-events: none;
    background-color: var(--white);
    border-color: var(--gray-200);
    opacity: 0.6;
}

/* ===== 14. UTILITIES ===== */
.text-gold { color: var(--brand-gold) !important; }
.bg-gold { background: var(--brand-gold) !important; }
.shadow-gold { box-shadow: var(--shadow-gold); }
.bg-slate-dark { background: var(--brand-slate-dark) !important; }

.messages-container .alert {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* ===== 15. TOAST NOTIFICATIONS ===== */
.toast-container { z-index: 2000; }

.toast-notification {
    background: var(--white);
    border-inline-start: 4px solid var(--brand-gold);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--brand-slate-dark);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    min-width: 300px;
    max-width: 450px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    position: relative;
    overflow: hidden;
}

.toast-notification.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-notification.hide { opacity: 0; transform: translateY(-10px) scale(0.95); }

.toast-icon { font-size: 1.25rem; margin-top: 0.1rem; }
.toast-icon-success { color: var(--success); }
.toast-icon-error   { color: var(--error); }
.toast-icon-warning { color: var(--warning); }
.toast-icon-info    { color: var(--info); }

.toast-content { flex: 1; }

.toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: var(--brand-slate-dark);
}

.toast-message {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin: 0;
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.2rem;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover { color: var(--brand-slate-dark); }

.toast-progress {
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    height: 3px;
    background: var(--brand-gold);
    width: 100%;
}

[dir="rtl"] .toast-progress { transform-origin: right; }
[dir="ltr"] .toast-progress { transform-origin: left; }

/* ===== 16. SPINNER ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--brand-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 17. CONFIRMATION DIALOG ===== */
.confirmation-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.confirmation-backdrop.show { opacity: 1; }

.confirmation-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: 1060;
    width: 90%;
    max-width: 500px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirmation-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.confirmation-modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border-top: 4px solid var(--brand-gold);
}

.confirmation-modal-header {
    padding: 1rem;
    display: flex;
    justify-content: flex-end;
}

.confirmation-modal-header .btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.confirmation-modal-header .btn-close:hover { color: var(--brand-slate-dark); }

.confirmation-modal-body { padding: 0 2rem 1.5rem; text-align: center; }

.confirmation-icon { margin-bottom: 1rem; }
.confirmation-icon.text-danger  { color: var(--error); }
.confirmation-icon.text-warning { color: var(--warning); }
.confirmation-icon.text-success { color: var(--success); }
.confirmation-icon.text-info    { color: var(--info); }

.confirmation-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--brand-slate-dark);
    margin-bottom: 0.75rem;
}

.confirmation-message {
    font-size: 1rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin: 0;
}

.confirmation-message strong {
    color: var(--brand-slate-dark);
    font-weight: 700;
}

.confirmation-modal-footer {
    padding: 1rem 2rem 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.confirmation-modal-footer .btn {
    min-width: 120px;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.confirmation-modal-footer .btn:hover { transform: translateY(-2px); }

.confirmation-modal-footer .btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.confirmation-icon i { animation: iconPulse 0.5s ease; }

@keyframes iconPulse {
    0%   { transform: scale(0);    opacity: 0; }
    50%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1);    opacity: 1; }
}

@media (max-width: 576px) {
    .confirmation-modal { width: 95%; max-width: none; }
    .confirmation-modal-body { padding: 0 1.25rem 1rem; }
    .confirmation-modal-footer { padding: 1rem 1.25rem 1.5rem; flex-direction: column; }
    .confirmation-modal-footer .btn { width: 100%; }
}

/* ===== 18. BOOTSTRAP MODAL HARMONIZATION ===== */
.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
}

.modal-footer { border-top: 1px solid var(--gray-200); }

.dropdown-menu {
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
}

.dropdown-item.active,
.dropdown-item:active { background: var(--gold-tint-12); color: var(--brand-slate-dark); }

/* ===== 19. AUTH / LOGIN COMPONENTS ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(197, 160, 40, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(197, 160, 40, 0.10) 0%, transparent 45%),
        var(--brand-slate-dark);
    font-family: var(--font-base);
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.auth-brand {
    background: var(--brand-slate-extra-dark);
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom: 3px solid var(--brand-gold);
}

.auth-brand img { height: 58px; width: auto; }

.auth-brand h1 {
    color: var(--brand-gold);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin: 0.75rem 0 0.15rem;
    text-transform: uppercase;
}

.auth-brand p {
    color: var(--brand-gold-light);
    font-size: 0.78rem;
    opacity: 0.9;
    margin: 0;
}

.auth-body { padding: 2rem 2rem 1.5rem; }

.auth-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-slate-dark);
    margin-bottom: 1.25rem;
    text-align: center;
}

.auth-field { margin-bottom: 1.1rem; }

.auth-field label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.35rem;
    display: block;
}

.auth-input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: var(--font-base);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--gray-50);
}

.auth-input:focus {
    outline: none;
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 0.2rem var(--gold-focus-ring);
    background: var(--white);
}

.auth-submit {
    width: 100%;
    padding: 0.75rem;
    background: var(--brand-gold-gradient);
    color: var(--brand-slate-dark);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 1rem;
    font-family: var(--font-base);
    cursor: pointer;
    box-shadow: var(--shadow-gold);
    transition: filter 0.2s ease, transform 0.2s ease;
}

.auth-submit:hover { filter: brightness(1.08); transform: translateY(-1px); }

.auth-error {
    background: #FEE2E2;
    color: #991B1B;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1.1rem;
    text-align: center;
}

.auth-footer {
    padding: 1rem 2rem 1.5rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* ===== 20. RESPONSIVE TYPOGRAPHY ===== */
@media (max-width: 768px) {
    .page-title, .jaguar-page-title { font-size: 1.3rem; }
    .stat-value { font-size: 1.6rem; }
    .logo-text h1 { font-size: 1rem; }
}
