/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* --- CSS Variables --- */
:root {
    --primary-color: #0e2133;
    --primary-light: #1c3a55;
    --secondary-color: #dba227;
    --secondary-light: #e6b85c;
    --background-color: #f4f7f9;
    --card-bg-color: #ffffff;
    --text-color: #34495e;
    --text-light-color: #7f8c8d;
    --border-color: #e1e5e8;
    --success-color: #27ae60;
    --error-color: #c0392b;
    --warning-color: #f39c12;
    --info-color: #2980b9;
    --white-color: #fff;
    --black-color: #000;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

body.dark-mode {
    --primary-color: #0a1929;
    --primary-light: #122b44;
    --secondary-color: #e6b325;
    --secondary-light: #f0c44a;
    --background-color: #081421;
    --card-bg-color: #0e1e2e;
    --text-color: #ecf0f1;
    --text-light-color: #95a5a6;
    --border-color: #2c3e50;
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    direction: rtl;
    line-height: 1.7;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    font-size: 14px;
}

.page-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 220px;
    background-color: var(--primary-color);
    color: var(--white-color);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.8rem;
    transition: width var(--transition-speed);
    position: fixed;
    height: 100%;
    right: 0;
    top: 0;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.sidebar-header .logo-text {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white-color);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-grow: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.nav-link:hover {
    background-color: var(--primary-light);
    color: var(--white-color);
}

.nav-link.active {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 700;
}

.nav-link i {
    font-size: 1.1rem;
    width: 18px;
    text-align: center;
}

.nav-group {
    color: #bdc3c7;
}

.nav-group-summary {
    list-style: none;
    cursor: pointer;
}

.nav-group-summary::-webkit-details-marker {
    display: none;
}

.nav-group-chevron {
    margin-right: auto;
    transition: transform var(--transition-speed);
}

.nav-group[open] .nav-group-chevron {
    transform: rotate(180deg);
}

.nav-submenu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
    padding-right: 1.1rem;
    border-right: 1px solid var(--primary-light);
}

.nav-sub-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.82rem;
    line-height: 1.45;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.nav-sub-link:hover {
    background-color: var(--primary-light);
    color: var(--white-color);
}

.nav-sub-link i {
    width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

.sidebar-footer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-light-color);
    padding-top: 0.8rem;
    border-top: 1px solid var(--primary-light);
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    margin-right: 220px;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.main-header {
    background-color: var(--card-bg-color);
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

body.dark-mode .header-title h1 {
    color: var(--secondary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
}

/* ساعة حية مضغوطة في هيدر لوحة التحكم */
.header-live-clock {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--text-light-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.header-live-clock i {
    font-size: 0.72rem;
    opacity: 0.85;
}

body.dark-mode .header-live-clock {
    color: var(--text-secondary, #94a3b8);
    background-color: rgba(255, 255, 255, 0.06);
    border-color: var(--border-color);
}

.header-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-light-color);
    cursor: pointer;
    position: relative;
}

.header-btn:hover {
    color: var(--secondary-color);
}

/* --- Global Smart Search --- */
.top-toolbar {
    position: relative;
    z-index: 120;
}

.global-search-wrapper {
    min-width: min(620px, 100%);
}

.global-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--card-bg-color), rgba(255, 255, 255, 0.92));
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: 0 12px 35px rgba(14, 33, 51, 0.08);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed), transform var(--transition-speed);
    overflow: hidden;
}

.global-search-wrapper:focus-within .global-search-box,
.global-search-wrapper.is-open .global-search-box {
    border-color: var(--secondary-color);
    box-shadow: 0 16px 45px rgba(219, 162, 39, 0.18), 0 0 0 4px rgba(219, 162, 39, 0.12);
    transform: translateY(-1px);
}

.global-search-icon {
    position: absolute;
    right: 1.1rem;
    color: var(--secondary-color);
    font-size: 1rem;
    pointer-events: none;
}

.global-search-input {
    width: 100%;
    height: 46px;
    padding: 0.65rem 3rem 0.65rem 3rem;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--text-color);
    font-weight: 600;
}

.global-search-input::placeholder {
    color: var(--text-light-color);
    font-weight: 500;
}

.global-search-clear {
    position: absolute;
    left: 0.75rem;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: var(--text-light-color);
    background: rgba(14, 33, 51, 0.08);
    cursor: pointer;
    transition: background-color var(--transition-speed), color var(--transition-speed), transform var(--transition-speed);
}

.global-search-clear:hover {
    color: var(--error-color);
    background: rgba(192, 57, 43, 0.12);
    transform: rotate(90deg);
}

.global-search-results {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    left: 0;
    z-index: 1300;
    max-height: 430px;
    overflow: hidden;
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(14, 33, 51, 0.22);
}

.global-search-results-header,
.global-search-results-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(14, 33, 51, 0.04);
    color: var(--text-light-color);
    font-size: 0.82rem;
    font-weight: 700;
}

.global-search-results-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.35rem;
}

.global-search-result-item {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--text-color);
    text-align: right;
    cursor: pointer;
    transition: background-color var(--transition-speed), transform var(--transition-speed), box-shadow var(--transition-speed);
}

.global-search-result-item:hover,
.global-search-result-item.active {
    background: linear-gradient(135deg, rgba(219, 162, 39, 0.12), rgba(14, 33, 51, 0.04));
    transform: translateX(-2px);
    box-shadow: inset 3px 0 0 var(--secondary-color);
}

.global-search-result-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(219, 162, 39, 0.14);
    color: var(--secondary-color);
}

.global-search-result-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.global-search-result-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-result-meta,
.global-search-result-type {
    color: var(--text-light-color);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-status {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.global-search-status-approved {
    color: #166534;
    background: rgba(34, 197, 94, 0.16);
}

.global-search-status-pending {
    color: #92400e;
    background: rgba(245, 158, 11, 0.18);
}

.global-search-status-rejected {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.16);
}

.global-search-status-printed,
.global-search-status-default {
    color: var(--primary-color);
    background: rgba(14, 33, 51, 0.1);
}

.global-search-state,
.global-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 1.4rem;
    color: var(--text-light-color);
    text-align: center;
}

.global-search-state i,
.global-search-empty i {
    color: var(--secondary-color);
    font-size: 1.4rem;
}

.global-search-error i {
    color: var(--error-color);
}

.global-search-results-footer kbd {
    padding: 0.1rem 0.35rem;
    border-radius: 5px;
    background: rgba(14, 33, 51, 0.1);
    color: var(--text-color);
    font-size: 0.72rem;
}

body.dark-mode .global-search-box {
    background: linear-gradient(135deg, var(--card-bg-color), rgba(18, 43, 68, 0.9));
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

body.dark-mode .global-search-results {
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

body.dark-mode .global-search-status-printed,
body.dark-mode .global-search-status-default {
    color: var(--secondary-color);
    background: rgba(230, 179, 37, 0.12);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--error-color);
    color: var(--white-color);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* --- Notification Center --- */
.notification-center {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: min(420px, calc(100vw - 2rem));
    background: var(--card-bg-color);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(14, 33, 51, 0.22);
    border: 1px solid var(--border-color);
    overflow: hidden;
    z-index: 1400;
}

.notification-center::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 22px;
    width: 16px;
    height: 16px;
    background: var(--card-bg-color);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    transform: rotate(45deg);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(14, 33, 51, 0.06), rgba(219, 162, 39, 0.08));
}

.notification-header h3 {
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-color);
}

.notification-header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.notification-header button,
.notification-header-actions button {
    background: rgba(219, 162, 39, 0.12);
    border: 1px solid rgba(219, 162, 39, 0.25);
    border-radius: 999px;
    color: var(--secondary-color);
    padding: 0.25rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.notification-header-actions button:hover {
    background: rgba(219, 162, 39, 0.2);
}

.notification-header-actions button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.notification-header-actions button.is-enabled {
    color: #166534;
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.28);
}

.notification-list {
    max-height: 420px;
    overflow-y: auto;
    padding: 0.55rem;
}

.notification-item {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem;
    border: 1px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color var(--transition-speed), border-color var(--transition-speed), transform var(--transition-speed), box-shadow var(--transition-speed);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: rgba(219, 162, 39, 0.08);
    border-color: rgba(219, 162, 39, 0.25);
    transform: translateX(-2px);
}

.notification-item.unread {
    background: linear-gradient(135deg, rgba(219, 162, 39, 0.13), rgba(14, 33, 51, 0.04));
    border-color: rgba(219, 162, 39, 0.25);
    box-shadow: inset 4px 0 0 var(--secondary-color);
}

.notification-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(219, 162, 39, 0.16);
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.notification-content {
    min-width: 0;
}

.notification-content strong {
    display: block;
    margin-bottom: 0.1rem;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 800;
}

.notification-content p {
    margin: 0;
    color: var(--text-light-color);
    font-size: 0.86rem;
    line-height: 1.55;
}

.notification-content small {
    display: block;
    margin-top: 0.35rem;
    color: var(--secondary-color);
    font-weight: 700;
}

.notification-count-pill {
    min-width: 34px;
    height: 34px;
    padding: 0 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary-color);
    color: white;
    font-weight: 900;
}

.notification-empty {
    grid-template-columns: 46px 1fr;
    cursor: default;
}

.notification-empty:hover {
    transform: none;
    background: transparent;
    border-color: transparent;
}

body.dark-mode .notification-item.unread {
    background: linear-gradient(135deg, rgba(230, 179, 37, 0.14), rgba(18, 43, 68, 0.55));
}

body.dark-mode .notification-center {
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

/* --- Page Content --- */
.page-content-wrapper {
    padding: 1.5rem;
    flex-grow: 1;
}

/* Tab Content - display is controlled by dashboard.js */
.tab-content.active {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Cards --- */
.dashboard-card {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

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

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-title i {
    color: var(--secondary-color);
}

.card-body {
    padding: 1.2rem;
}

/* --- Forms & Filters --- */
.filters-container, .filters-grid, .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
}

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

.form-group label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 0.9rem;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

body.dark-mode .form-control, body.dark-mode .form-select {
    background-color: var(--primary-light);
    border-color: #2c3e50;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(219, 162, 39, 0.2);
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--error-color);
}

.form-text-error {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.filter-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.2rem;
    justify-content: center;
}

/* --- Buttons --- */
.btn {
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--secondary-light);
    transform: translateY(-2px);
}

.btn-outline-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

body.dark-mode .btn-outline-secondary:hover {
    background-color: var(--primary-light);
}

/* --- Stats Cards --- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.2rem;
}

.stats-card {
    background-color: var(--card-bg-color);
    padding: 1.2rem;
    border-radius: var(--border-radius);
    text-align: center;
    border-bottom: 4px solid;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stats-card h5 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.stats-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
}

/* Assigning border colors to stats cards */
.stats-card.total { border-color: var(--primary-color); }
.stats-card.total .stat-value { color: var(--primary-color); }
.stats-card.type-1 { border-color: var(--info-color); }
.stats-card.type-1 .stat-value { color: var(--info-color); }
.stats-card.type-2 { border-color: var(--success-color); }
.stats-card.type-2 .stat-value { color: var(--success-color); }
.stats-card.type-3 { border-color: var(--warning-color); }
.stats-card.type-3 .stat-value { color: var(--warning-color); }
.stats-card.type-4 { border-color: var(--error-color); }
.stats-card.type-4 .stat-value { color: var(--error-color); }
.stats-card.type-5 { border-color: #8e44ad; }
.stats-card.type-5 .stat-value { color: #8e44ad; }
.stats-card.type-6 { border-color: #3498db; }
.stats-card.type-6 .stat-value { color: #3498db; }
.stats-card.type-7 { border-color: #1abc9c; }
.stats-card.type-7 .stat-value { color: #1abc9c; }
.stats-card.type-8 { border-color: #e67e22; }
.stats-card.type-8 .stat-value { color: #e67e22; }
.stats-card.type-9 { border-color: #95a5a6; }
.stats-card.type-9 .stat-value { color: #95a5a6; }
.stats-card.type-10 { border-color: #2c3e50; }
.stats-card.type-10 .stat-value { color: #2c3e50; }

.stat-icon {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

/* --- Enhanced Statistics Styles --- */
.stats-hero-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(14, 33, 51, 0.3);
    color: white;
    position: relative;
    overflow: hidden;
}

.stats-hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.stats-hero-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.stats-hero-icon {
    font-size: 5rem;
    opacity: 0.2;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.stats-hero-info {
    flex: 1;
}

.stats-hero-label {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-hero-value {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.stats-hero-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    position: relative;
    z-index: 1;
}

.stats-hero-summary > div {
    text-align: center;
    padding: 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stats-hero-summary > div:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-5px);
}

.stats-hero-summary .h5 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.stats-hero-summary .small {
    font-size: 0.85rem;
    opacity: 0.9;
}

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

.stats-office-card {
    background: var(--card-bg-color);
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.stats-office-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}

.stats-office-embassy {
    border-top: 5px solid var(--primary-color);
}

.stats-office-embassy .stats-office-icon {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.stats-office-tarabot {
    border-top: 5px solid var(--secondary-color);
}

.stats-office-tarabot .stats-office-icon {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-light) 100%);
    color: var(--primary-color);
}

.stats-office-public {
    border-top: 5px solid #0ea5e9;
}

.stats-office-public .stats-office-icon {
    background: linear-gradient(135deg, #0ea5e9 0%, #7dd3fc 100%);
    color: white;
}

.stats-office-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(to bottom, rgba(14, 33, 51, 0.05), transparent);
}

.stats-office-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stats-office-title {
    flex: 1;
}

.stats-office-title h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.stats-office-badge {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 700;
    background: var(--primary-color);
    color: white;
}

.stats-office-embassy .stats-office-badge {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.stats-office-tarabot .stats-office-badge {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-light) 100%);
    color: var(--primary-color);
}

.stats-office-public .stats-office-badge {
    background: linear-gradient(135deg, #0ea5e9 0%, #7dd3fc 100%);
    color: white;
}

.stats-office-body {
    padding: 2rem;
}

.stats-distribution-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light-color);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-distribution-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.stats-distribution-item {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stats-progress-wrapper {
    margin-bottom: 1rem;
}

.stats-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stats-progress-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.stats-progress-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-light-color);
}

.stats-progress-bar {
    height: 12px;
    background: var(--background-color);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.stats-progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
    position: relative;
    overflow: hidden;
}

.stats-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.stats-office-embassy .stats-progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.stats-office-tarabot .stats-progress-fill {
    background: linear-gradient(90deg, var(--secondary-color), var(--secondary-light));
}

.stats-office-public .stats-progress-fill {
    background: linear-gradient(90deg, #0ea5e9, #7dd3fc);
}

.stats-loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light-color);
    font-size: 1rem;
}

.stats-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* --- Employees Table --- */
.stats-employees-card {
    background: var(--card-bg-color);
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 2rem;
}

.stats-employees-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.stats-employees-header i {
    font-size: 1.5rem;
}

.stats-employees-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.stats-employees-body {
    padding: 0;
}

.stats-employees-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-employees-table thead {
    background: var(--background-color);
}

.stats-employees-table th {
    padding: 1.2rem 1.5rem;
    text-align: right;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.stats-employees-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.stats-employees-table tbody tr:hover {
    background: var(--background-color);
    transform: scale(1.01);
}

.stats-employees-table tbody tr:last-child {
    border-bottom: none;
}

.stats-employees-table td {
    padding: 1.2rem 1.5rem;
    text-align: right;
    font-size: 0.95rem;
}

.stats-employee-name {
    font-weight: 700;
    color: var(--text-color);
}

.stats-employee-role-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stats-employee-role-embassy {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.stats-employee-role-tarabot {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-light) 100%);
    color: var(--primary-color);
}

.stats-employee-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats-employee-progress-percent {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-light-color);
    min-width: 45px;
}

.stats-employee-progress-bar {
    flex: 1;
    height: 10px;
    background: var(--background-color);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.stats-employee-progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
}

.stats-employee-progress-embassy {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.stats-employee-progress-tarabot {
    background: linear-gradient(90deg, var(--secondary-color), var(--secondary-light));
}

/* Dark mode adjustments */
body.dark-mode .stats-office-card {
    background: var(--card-bg-color);
}

body.dark-mode .stats-employees-card {
    background: var(--card-bg-color);
}

body.dark-mode .stats-employees-table thead {
    background: var(--primary-light);
}

body.dark-mode .stats-progress-bar {
    background: var(--primary-light);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-hero-value {
        font-size: 3rem;
    }
    
    .stats-hero-summary {
        grid-template-columns: 1fr;
    }
    
    .stats-comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-office-header {
        flex-direction: column;
        text-align: center;
    }
}

/* --- Reports Section --- */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.report-category {
    background-color: var(--background-color);
    padding: 1.2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

body.dark-mode .report-category {
    background-color: var(--primary-light);
}

.report-category-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.report-category-title i {
    color: var(--secondary-color);
}

.report-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--card-bg-color);
    font-size: 0.9rem;
}

.transactions-table th,
.transactions-table td {
    padding: 0.9rem 0.8rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.transactions-table th {
    background-color: var(--background-color);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-color);
    text-transform: uppercase;
}

body.dark-mode .transactions-table th {
    background-color: var(--primary-light);
}

.transactions-table tbody tr:hover {
    background-color: var(--background-color);
}

body.dark-mode .transactions-table tbody tr:hover {
    background-color: var(--primary-light);
}

.transactions-table .date-time,
.modern-table .date-time {
    display: flex;
    flex-direction: column;
}

.transactions-table .date-time .date,
.modern-table .date-time .date {
    font-weight: 600;
}

.transactions-table .date-time .time,
.modern-table .date-time .time {
    font-size: 0.8rem;
    color: var(--text-light-color);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-light-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.btn-action.btn-view:hover {
    background-color: var(--info-color);
    color: var(--white-color);
    border-color: var(--info-color);
}

.no-data-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-light-color);
}

.no-data-message i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* --- Status Badges --- */
.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid transparent;
}

.status-badge.approved {
    background-color: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
    border-color: var(--success-color);
}

.status-badge.pending {
    background-color: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.status-badge.rejected {
    background-color: rgba(192, 57, 43, 0.1);
    color: var(--error-color);
    border-color: var(--error-color);
}

.status-badge.printed {
    background-color: rgba(41, 128, 185, 0.1);
    color: var(--info-color);
    border-color: var(--info-color);
}

.status-badge.N-A {
    background-color: rgba(127, 140, 141, 0.1);
    color: var(--text-light-color);
    border-color: var(--text-light-color);
}

/* --- Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    max-width: 550px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.4s;
}

@keyframes slideInUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}


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

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light-color);
    cursor: pointer;
    transition: color var(--transition-speed), transform var(--transition-speed);
}

.modal-close:hover {
    color: var(--error-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* --- Transaction Details Modal Style --- */
.transaction-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.transaction-details .detail-row:last-child {
    border-bottom: none;
}

.transaction-details .detail-row strong {
    font-weight: 700;
    color: var(--text-color);
    margin-left: 1rem;
}

.transaction-details .detail-row span {
    color: var(--text-light-color);
    text-align: left;
}



/* --- Toast Notifications --- */
#toastContainer {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toast {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 0.8rem 1rem;
    border-right: 3px solid;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 250px;
    animation: slideInLeft 0.3s ease-out;
    font-size: 0.9rem;
}

.toast.success {
    border-color: var(--success-color);
}

.toast.error {
    border-color: var(--error-color);
}

.toast.warning {
    border-color: var(--warning-color);
}

.toast.info {
    border-color: var(--info-color);
}

.toast-icon {
    font-size: 1.1rem;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--info-color);
}

.toast-message {
    flex-grow: 1;
    font-weight: 500;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}


/* --- Loading Spinner --- */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    gap: 0.8rem;
    color: var(--text-light-color);
}

.loading-spinner i {
    font-size: 1.5rem;
    color: var(--secondary-color);
}


/* --- Pagination --- */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.pagination-controls .btn {
    min-width: 100px;
}

#pageInfo {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}


/* --- Badge --- */
.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    background-color: var(--primary-light);
    color: var(--white-color);
}

/* --- Pagination Styles --- */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
    border-radius: 0 0 8px 8px;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-buttons .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.pagination-buttons .btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-buttons .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- Loading Spinner for Table --- */
.loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 8px;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Smart Lists Statistics Styles --- */
.stats-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.stats-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
    min-height: 120px;
}

.stats-button:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stats-button i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.stats-button:hover i {
    transform: scale(1.1);
    color: var(--primary-dark);
}

.stats-button span {
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    line-height: 1.4;
}

.stats-list {
    max-height: 400px;
    overflow-y: auto;
}

.smart-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.smart-stat-item:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.smart-stat-name {
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    margin-left: 12px;
    font-size: 14px;
}

.smart-stat-count {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    min-width: 40px;
    text-align: center;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 40px 20px;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
}

/* --- Print Styles --- */
@media print {
    .sidebar,
    .main-header,
    .filter-actions,
    .modal,
    #toastContainer,
    .pagination-container {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .page-content-wrapper {
        padding: 0;
    }
    
    .dashboard-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(100%);
        transition: transform var(--transition-speed);
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .page-content-wrapper {
        padding: 1rem;
    }
    
    .main-header {
        padding: 0.8rem 1rem;
    }
    
    .header-title h1 {
        font-size: 1.2rem;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .reports-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }
    
    .notification-center {
        left: 0;
        right: auto;
        width: min(360px, calc(100vw - 1rem));
    }
}

/* --- Welcome Toast --- */
.toast.toast-welcome {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: var(--primary-color);
    border-right-width: 5px;
    border-right-style: solid;
    border-image: linear-gradient(to bottom, var(--primary-color), var(--primary-light)) 1;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    transform: translateZ(0); /* Promote to own layer for animation */
    animation: slideInAndOut 5s forwards ease-in-out;
}

.toast.toast-welcome .toast-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.toast.toast-welcome .toast-message {
    font-weight: 700;
    font-size: 1.1rem;
}

@keyframes slideInAndOut {
    0% {
        transform: translateX(-120%);
        opacity: 0;
    }
    15% {
        transform: translateX(0);
        opacity: 1;
    }
    85% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* --- Statistics Modal Enhancements --- */
.smart-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.smart-stat-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.smart-stat-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    margin-right: 16px;
}

.smart-stat-name {
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
}

.smart-stat-count {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: 12px;
}

/* --- Transactions Modal --- */
.modal-large {
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
}

.transactions-table-container {
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.transactions-table th {
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    text-align: right;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.transactions-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.transactions-table tbody tr:hover {
    background: var(--hover-bg);
}

.transactions-table tbody tr:last-child td {
    border-bottom: none;
}

.transactions-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
}

.transactions-pagination .pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.transactions-pagination .pagination-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.transactions-pagination .page-info {
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-color);
}

/* --- Status Badges --- */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* --- Loading Spinner in Modal --- */
.modal .loading-spinner {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.modal .loading-spinner i {
    font-size: 2rem;
    margin-bottom: 16px;
    display: block;
}

/* --- No Data Message --- */
.modal .no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Transaction Details Modal --- */
.transaction-details {
    padding: 20px 0;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.detail-item label {
    font-weight: 600;
    color: var(--text-color);
    margin-left: 12px;
}

.detail-item span {
    color: var(--text-muted);
    text-align: left;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* --- Action Buttons in Table --- */
.transactions-table .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.transactions-table .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.transactions-table .btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.transactions-table .btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* --- Responsive Table --- */
@media (max-width: 768px) {
    .transactions-table-container {
        overflow-x: auto;
    }
    
    .transactions-table {
        min-width: 600px;
    }
    
    .transactions-table th,
    .transactions-table td {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* ================================================
 * Role-based Visibility Rules
 * ملاحظة: في نظام الخطابات القنصلية يتم التحكم بالإظهار/الإخفاء
 * حسب الدور (super_admin / admin / user) عبر JavaScript
 * في static/js/dashboard.js (applyRoleVisibility)، لذا تم تعطيل
 * قواعد الإخفاء المرجعية القديمة هنا لتفادي التعارض.
 * ================================================ */

/* ================================================
 * Internal Tabs for Pending Requests
 * ================================================ */

.internal-tabs {
    background: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-top: 1.5rem;
}

.internal-tab-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--background-color);
    border-bottom: 2px solid var(--border-color);
}

.internal-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-light-color);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    position: relative;
}

.internal-tab-btn:hover {
    background: var(--card-bg-color);
    color: var(--text-color);
}

.internal-tab-btn.active {
    background: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

.internal-tab-btn.active .tab-badge {
    background: var(--white-color);
    color: var(--primary-color);
}

.tab-badge {
    background: var(--text-light-color);
    color: var(--white-color);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.internal-tab-content {
    display: none !important;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.internal-tab-content.active {
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* ================================================
 * Transaction Source Tabs for Transactions Table
 * ================================================ */

.transaction-source-tabs {
    background: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.transaction-source-tab-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--background-color);
    border-bottom: 2px solid var(--border-color);
}

.transaction-source-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-light-color);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    position: relative;
}

.transaction-source-tab-btn:hover {
    background: var(--card-bg-color);
    color: var(--text-color);
}

.transaction-source-tab-btn.active {
    background: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

.transaction-source-tab-btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .transaction-source-tab-nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .transaction-source-tab-btn {
        width: 100%;
    }
}

/* Search and Filter Bar */
.search-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    position: relative;
}

.search-box i {
    position: absolute;
    right: 1rem;
    color: var(--text-light-color);
    z-index: 1;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg-color);
    color: var(--text-color);
    transition: all var(--transition-speed);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 33, 51, 0.1);
}

/* Search highlight */
mark {
    background-color: var(--secondary-color);
    color: var(--white-color);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

body.dark-mode mark {
    background-color: var(--secondary-light);
    color: var(--primary-color);
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select,
.filter-date {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg-color);
    color: var(--text-color);
    transition: all var(--transition-speed);
    min-width: 180px;
}

.filter-date {
    min-width: 150px;
}

.filter-select:focus,
.filter-date:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 33, 51, 0.1);
}

/* Modern Table Styles */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.modern-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white-color);
}

.modern-table thead th {
    padding: 1rem;
    text-align: right;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.modern-table tbody tr {
    transition: all var(--transition-speed);
    border-bottom: 1px solid var(--border-color);
}

.modern-table tbody tr:hover {
    background: var(--background-color);
    transform: translateX(-2px);
    box-shadow: -2px 0 8px rgba(14, 33, 51, 0.1);
}

.modern-table tbody tr:last-child {
    border-bottom: none;
}

.modern-table tbody td {
    padding: 1rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

.modern-table tbody td:first-child {
    text-align: center;
}

/* Bulk Actions Toolbar */
.bulk-actions-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.bulk-actions-toolbar .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all var(--transition-speed);
    white-space: nowrap;
}

.bulk-actions-toolbar .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Enhanced Bulk Actions Toolbar for Transactions */
.bulk-actions-toolbar-transactions {
    display: flex;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark-mode .bulk-actions-toolbar-transactions {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--card-bg-color) 100%);
    border-color: var(--border-color);
}

.bulk-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.bulk-actions-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bulk-actions-count {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--primary-color);
    color: var(--white-color);
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(14, 33, 51, 0.2);
}

.bulk-actions-count i {
    font-size: 1.1rem;
}

.bulk-actions-scope {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    color: var(--text-color);
    font-weight: 700;
}

.bulk-actions-scope select {
    min-width: 190px;
    padding: 0.65rem 0.85rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg-color);
    color: var(--text-color);
    font-weight: 600;
}

.bulk-actions-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-actions-toolbar-transactions .btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.bulk-actions-toolbar-transactions .btn i {
    font-size: 1rem;
}

.bulk-actions-toolbar-transactions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bulk-actions-toolbar-transactions .btn:active {
    transform: translateY(0);
}

.bulk-actions-toolbar-transactions .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Archive Button */
.bulk-actions-toolbar-transactions .btn-archive {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: var(--white-color);
}

.bulk-actions-toolbar-transactions .btn-archive:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

/* Restore Button */
.bulk-actions-toolbar-transactions .btn-restore {
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    color: var(--white-color);
}

.bulk-actions-toolbar-transactions .btn-restore:hover {
    background: linear-gradient(135deg, #229954 0%, #196f3d 100%);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

/* Delete Button */
.bulk-actions-toolbar-transactions .btn-delete {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: var(--white-color);
}

.bulk-actions-toolbar-transactions .btn-delete:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

/* Cancel Button */
.bulk-actions-toolbar-transactions .btn-cancel {
    background: var(--card-bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.bulk-actions-toolbar-transactions .btn-cancel:hover {
    background: var(--background-color);
    border-color: var(--text-light-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode .bulk-actions-toolbar-transactions .btn-cancel {
    background: var(--primary-light);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .bulk-actions-toolbar-transactions .btn-cancel:hover {
    background: var(--card-bg-color);
    border-color: var(--text-light-color);
}

body.dark-mode .bulk-actions-scope select {
    background: var(--card-bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* Dark Mode Adjustments */
body.dark-mode .internal-tab-nav {
    background: var(--primary-light);
    border-bottom-color: var(--border-color);
}

body.dark-mode .internal-tab-btn:hover {
    background: var(--card-bg-color);
}

body.dark-mode .search-filter-bar {
    background: var(--primary-light);
    border-color: var(--border-color);
}

body.dark-mode .search-box input,
body.dark-mode .filter-select,
body.dark-mode .filter-date {
    background: var(--card-bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .bulk-actions-toolbar {
    background: var(--primary-light);
    border-color: var(--border-color);
}

body.dark-mode .modern-table tbody tr:hover {
    background: var(--primary-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .internal-tab-nav {
        flex-direction: column;
    }

    .internal-tab-btn {
        width: 100%;
    }

    .search-filter-bar {
        padding: 1rem;
    }

    .filter-group {
        flex-direction: column;
    }

    .filter-select,
    .filter-date {
        width: 100%;
        min-width: 100%;
    }

    .bulk-actions-toolbar {
        flex-direction: column;
    }

    .bulk-actions-toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    .bulk-actions-toolbar-transactions {
        padding: 1rem;
    }

    .bulk-actions-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .bulk-actions-count {
        justify-content: center;
        width: 100%;
    }

    .bulk-actions-buttons {
        flex-direction: column;
        width: 100%;
    }

    .bulk-actions-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .modern-table {
        font-size: 0.85rem;
    }

    .modern-table thead th,
    .modern-table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

/* --- Rejection Modal Styles --- */
#rejectModal .modal-content {
    border-top: 5px solid var(--error-color);
}

#rejectModal .text-danger {
    color: var(--error-color) !important;
}

#rejectModal .form-group label {
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
}

#rejectModal textarea {
    resize: vertical;
    min-height: 100px;
}

/* --- Rejection Alert Modal Styles --- */
#rejectionAlertModal {
    z-index: 9999 !important;
}

#rejectionAlertModal .modal-content {
    animation: alertPulse 0.5s ease-in-out;
    border: 3px solid var(--error-color);
    box-shadow: 0 0 30px rgba(192, 57, 43, 0.5);
}

@keyframes alertPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes flash {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate__flash {
    animation: flash 1s ease-in-out infinite;
}

#rejectionAlertModal .modal-body {
    text-align: center;
}

#rejectionAlertModal h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

#alertReasonText {
    display: block;
    margin-top: 0.5rem;
    padding: 10px;
    background-color: #f8d7da;
    border-radius: 6px;
    text-align: right;
    direction: rtl;
}

/* --- Rejected Requests Tab Styles --- */
.internal-tab-btn[data-internal-tab="rejected-requests"] {
    border-color: #dc3545;
}

.internal-tab-btn[data-internal-tab="rejected-requests"].active {
    background-color: #dc3545;
    color: white;
}

.internal-tab-btn[data-internal-tab="rejected-requests"] .tab-badge {
    background-color: #dc3545;
    color: white;
}

#rejectedTable tbody tr {
    transition: all 0.3s ease;
}

#rejectedTable tbody tr:hover {
    background-color: #ffe5e5 !important;
    transform: translateX(-3px);
}

/* =====================================================================
   إضافات نظام الخطابات القنصلية
   ===================================================================== */

/* بطاقة المستخدم في الشريط العلوي */
.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-chip-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
}
.user-chip-name {
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.95rem;
}
.user-chip-role {
    font-size: 0.78rem;
    color: var(--text-light-color);
}
.user-chip-logout {
    background: var(--error-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: opacity var(--transition-speed);
}
.user-chip-logout:hover { opacity: 0.85; }
body.dark-mode .user-chip-name { color: #f1f5f9; }

/* عنوان القسم */
.section-header {
    margin-bottom: 1.25rem;
}
.section-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.25rem;
}
.section-header p {
    color: var(--text-light-color);
    margin: 0;
}
body.dark-mode .section-header h2 { color: #f1f5f9; }

/* قائمة القناصل في الإعدادات */
.consuls-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.consul-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.6rem;
    align-items: center;
}
@media (max-width: 640px) {
    .consul-row { grid-template-columns: 1fr; }
}

/* رسائل الحفظ */
.save-msg {
    font-weight: 600;
    font-size: 0.9rem;
    align-self: center;
}
.save-msg.ok { color: var(--success-color); }
.save-msg.err { color: var(--error-color); }

/* تفاصيل داخل النافذة المنبثقة */
.transaction-details .detail-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.transaction-details .detail-label {
    color: var(--text-light-color);
    font-weight: 600;
}
.transaction-details .detail-value {
    color: var(--text-color);
    font-weight: 700;
    text-align: left;
}
body.dark-mode .transaction-details .detail-value { color: #f1f5f9; }

/* حركة إخفاء التنبيه */
.toast.hide {
    animation: slideOutLeft 0.35s ease-in forwards;
}
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-120%); opacity: 0; }
}

/* التقارير */
.section-subtitle {
    color: var(--text-light-color);
    font-size: 0.9rem;
    margin: 0.25rem 0 0.75rem;
}
.report-results {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.report-block {
    margin-bottom: 1.5rem;
}
.report-block-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.6rem;
    padding-right: 0.5rem;
    border-right: 3px solid var(--primary-color);
}
body.dark-mode .report-block-title { color: #f1f5f9; }
.report-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.report-summary-item {
    flex: 1;
    min-width: 140px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    text-align: center;
}
.report-summary-item .num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
}
.report-summary-item .lbl {
    color: var(--text-light-color);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
body.dark-mode .report-summary-item { background: rgba(255,255,255,0.03); }
