/*
 * نظام إدارة عيادة الأسنان - التصميم الرئيسي
 * Dental Clinic Management System - Main Stylesheet
 */

/* ========== CSS Variables ========== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1428;
    --bg-card: rgb(15 20 40);;
    --bg-card-hover: rgba(20, 28, 55, 0.9);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-sidebar: rgba(8, 12, 28, 0.95);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --border-focus: #00d2ff;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --text-dim: rgba(255, 255, 255, 0.25);

    --accent-primary: #00d2ff;
    --accent-secondary: #3a60ff;
    --accent-gradient: linear-gradient(135deg, #00d2ff 0%, #3a60ff 100%);
    --accent-glow: rgba(0, 210, 255, 0.3);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);
    --purple: #8b5cf6;
    --purple-bg: rgba(139, 92, 246, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);

    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
:root.light-mode body {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f1f5f9;
    --bg-sidebar: #ffffff;

    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-focus: #3a60ff;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --accent-glow: rgba(58, 96, 255, 0.15);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 15px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);

    --bg-sidebar: #ffffff;
}

:root.light-mode body .top-header {
    background: rgba(255, 255, 255, 0.8);
}

:root.light-mode body .sidebar {
    background: #ffffff;
    border-left: 1px solid var(--border-color);
}

:root.light-mode body .nav-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

:root.light-mode body .data-table th {
    background: rgba(0, 0, 0, 0.02);
}

:root.light-mode body .data-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

:root.light-mode body .data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

:root.light-mode body .appointment-item {
    background: #ffffff;
}

:root.light-mode body .appointment-item:hover {
    background: #f8fafc;
}

/* ========== Reset & Base ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ========== Layout ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 5px 20px var(--accent-glow);
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    padding: 15px 12px;
    flex: 1;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    font-weight: 700;
    padding: 12px 14px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 210, 255, 0.1);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-gradient);
    border-radius: 3px;
}

.nav-item i {
    width: 22px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-right: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

/* Sidebar User */
.sidebar-user {
    padding: 15px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info span {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-logout:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ========== Sidebar Collapsed State ========== */
.sidebar.collapsed {
    width: 78px;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 15px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo {
    width: 42px;
    height: 42px;
    font-size: 18px;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

.sidebar.collapsed .sidebar-nav {
    padding: 10px 8px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
    position: relative;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .nav-item .badge {
    display: none;
}

.sidebar.collapsed .nav-item i {
    font-size: 18px;
    width: auto;
}

.sidebar.collapsed .nav-item.active::before {
    height: 28px;
}

/* Tooltip on hover for collapsed sidebar */
.sidebar.collapsed .nav-item::after {
    content: attr(data-title);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    z-index: 200;
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

/* Collapsed sidebar user section */
.sidebar.collapsed .sidebar-user {
    padding: 12px;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

.sidebar.collapsed .sidebar-user .user-profile-link {
    justify-content: center !important;
}

.sidebar.collapsed .sidebar-user .user-info {
    display: none;
}

.sidebar.collapsed .sidebar-user .user-avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
}

.sidebar.collapsed .sidebar-user .btn-logout {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main content shift when sidebar is collapsed */
.app-layout.sidebar-collapsed .main-content {
    margin-right: 78px;
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    position: relative;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Top Header ========== */
.top-header {
    height: var(--header-height);
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-size: 16px;
}

.menu-toggle:hover {
    color: var(--accent-primary);
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.menu-toggle i {
    transition: transform 0.3s ease;
}

:root.light-mode body .menu-toggle {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #475569;
}

.theme-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 18px;
    padding: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.theme-toggle i {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-toggle:hover {
    color: var(--accent-primary);
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

.theme-toggle:hover i {
    transform: rotate(360deg) scale(1.2);
}

.theme-toggle:active {
    transform: translateY(0) scale(0.95);
}

:root.light-mode body .theme-toggle {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

:root.light-mode body .theme-toggle:hover {
    background: #f8fafc;
    border-color: var(--accent-secondary);
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.page-title span {
    color: var(--accent-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-date {
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-search {
    position: relative;
}

.header-search input {
    padding: 10px 40px 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    width: 250px;
    transition: var(--transition);
    outline: none;
}

.header-search input:focus {
    border-color: var(--accent-primary);
    width: 300px;
    background: rgba(255,255,255,0.08);
}

.header-search input::placeholder {
    color: var(--text-dim);
}

.header-search i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

/* ========== Page Content ========== */
.page-content {
    padding: 30px;
}

/* ========== Stats Cards ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.15;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
    opacity: 0.25;
    width: 150px;
    height: 150px;
}

.stat-card.blue::before { background: var(--accent-primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.red::before { background: var(--danger); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-card.blue .stat-icon {
    background: rgba(0, 210, 255, 0.12);
    color: var(--accent-primary);
}
.stat-card.green .stat-icon {
    background: var(--success-bg);
    color: var(--success);
}
.stat-card.orange .stat-icon {
    background: var(--warning-bg);
    color: var(--warning);
}
.stat-card.purple .stat-icon {
    background: var(--purple-bg);
    color: var(--purple);
}
.stat-card.red .stat-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--accent-primary);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 15px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========== Grid Layouts ========== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ========== Tables ========== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 14px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 10px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.form-control::placeholder {
    color: var(--text-dim);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.4)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-left: 36px;
}

select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 10px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* ========== Status Badge ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-scheduled { background: var(--info-bg); color: var(--info); }
.status-scheduled::before { background: var(--info); }
.status-confirmed { background: var(--purple-bg); color: var(--purple); }
.status-confirmed::before { background: var(--purple); }
.status-in_progress, .status-in-progress { background: var(--warning-bg); color: var(--warning); }
.status-in_progress::before, .status-in-progress::before { background: var(--warning); }
.status-completed, .status-done { background: var(--success-bg); color: var(--success); }
.status-completed::before, .status-done::before { background: var(--success); }
.status-cancelled { background: var(--danger-bg); color: var(--danger); }
.status-cancelled::before { background: var(--danger); }
.status-no_show, .status-no-show { background: rgba(107,114,128,0.12); color: #9ca3af; }
.status-no_show::before, .status-no-show::before { background: #9ca3af; }
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-pending::before { background: var(--warning); }
.status-partial { background: rgba(249,115,22,0.12); color: #f97316; }
.status-partial::before { background: #f97316; }
.status-paid { background: var(--success-bg); color: var(--success); }
.status-paid::before { background: var(--success); }
.status-waiting { background: var(--warning-bg); color: var(--warning); }
.status-waiting::before { background: var(--warning); }
.status-called { background: var(--info-bg); color: var(--info); }
.status-called::before { background: var(--info); }
.status-in_room { background: var(--purple-bg); color: var(--purple); }
.status-in_room::before { background: var(--purple); }

/* ========== Appointment List ========== */
.appointment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.appointment-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.appointment-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.appointment-time {
    text-align: center;
    min-width: 65px;
    flex-shrink: 0;
}

.appointment-time .time {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-primary);
}

.appointment-time .period {
    font-size: 10px;
    color: var(--text-muted);
}

.appointment-divider {
    width: 3px;
    height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.appointment-info {
    flex: 1;
    min-width: 0;
}

.appointment-info .patient-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.appointment-info .appointment-type {
    font-size: 12px;
    color: var(--text-muted);
}

.appointment-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i {
    color: var(--accent-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

.modal-lg {
    max-width: 800px;
}

/* ========== Alerts ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #026b41;
}

.alert-error, .alert-danger {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-warning {
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #715700;
}

.alert-info {
    background: var(--info-bg);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state i {
    font-size: 50px;
    color: rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 20px 0;
}

.pagination a, .pagination span {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    color: var(--text-secondary);
}

.pagination a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.pagination .active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 10px var(--accent-glow);
}

/* ========== Toast Notification ========== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.toast.toast-success {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.toast.toast-error {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.toast.toast-info {
    background: rgba(59, 130, 246, 0.9);
    color: white;
}

.toast-close {
    margin-right: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 16px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== Dental Chart - Professional Design ========== */
.dental-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px 15px;
    position: relative;
}

.jaw-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.jaw-label::before,
.jaw-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.jaw-row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 0;
}

.jaw-row.lower {
    align-items: flex-start;
}

/* Quadrant separator in the middle */
.jaw-row::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 2px;
    height: 60px;
    background: linear-gradient(180deg, var(--accent-primary), transparent);
    opacity: 0.15;
    transform: translateX(-50%);
    pointer-events: none;
}

.tooth {
    width: 50px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tooth:hover {
    transform: translateY(-6px) scale(1.08);
    z-index: 10;
}

.tooth:hover .tooth-shape {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.tooth-shape {
    width: 40px;
    height: 46px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px 8px 14px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(5px);
}

.jaw-row.lower .tooth-shape {
    border-radius: 14px 14px 8px 8px;
}

/* Selected tooth - clicking animation */
.tooth.selected .tooth-shape {
    border-color: var(--accent-primary) !important;
    background: rgba(0, 210, 255, 0.15) !important;
    color: var(--accent-primary) !important;
    box-shadow: 0 0 15px var(--accent-glow), 0 0 30px rgba(0, 210, 255, 0.1) !important;
    animation: toothPulse 1.5s ease-in-out infinite;
}

@keyframes toothPulse {
    0%, 100% { box-shadow: 0 0 15px var(--accent-glow), 0 0 30px rgba(0, 210, 255, 0.1); }
    50% { box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(0, 210, 255, 0.2); }
}

/* HAS CONDITION: Do NOT override inline styles - just add a subtle indicator */
.tooth.has-condition .tooth-shape {
    /* Colors come from inline style per condition, no CSS override */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Extracted/Missing - special visual with X mark */
.tooth.extracted .tooth-shape {
    opacity: 0.7;
    position: relative;
}

.tooth.extracted .tooth-shape::before {
    content: '✕';
    position: absolute;
    font-size: 22px;
    font-weight: 900;
    opacity: 0.4;
    line-height: 1;
}

/* Healthy teeth */
.tooth.healthy .tooth-shape {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}

/* Tooth condition label */
.tooth-number {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-dim);
    margin-top: 5px;
    line-height: 1.2;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jaw-row.lower .tooth-number {
    margin-top: 0;
    margin-bottom: 5px;
}

/* Tooltip on hover */
.tooth[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    z-index: 100;
    pointer-events: none;
    animation: tooltipIn 0.2s ease;
}

.jaw-row.lower .tooth[data-tooltip]:hover::after {
    bottom: auto;
    top: calc(100% + 8px);
}

@keyframes tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Jaw separator */
.jaw-separator {
    width: 90%;
    max-width: 700px;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--border-color) 20%, var(--accent-primary) 50%, var(--border-color) 80%, transparent 100%);
    position: relative;
    opacity: 0.5;
    margin: 5px 0;
}

.jaw-separator::after {
    content: 'خط الإطباق';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    padding: 2px 16px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
    letter-spacing: 1px;
}

/* Legend styles */
.chart-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.chart-legend-item {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: var(--transition);
}

.chart-legend-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Tooth form card enhancements */
.tooth-form-card {
    border: 1px solid var(--accent-primary) !important;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.08);
}

.tooth-form-card .card-header {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.08), rgba(58, 96, 255, 0.08));
}

/* ========== Calendar Styles ========== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-header-cell {
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
}

.calendar-cell {
    min-height: 100px;
    max-height: 200px; /* أقصى ارتفاع للخلية */
    overflow-y: auto; /* إظهار شريط تمرير إذا زادت المواعيد */
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
}

/* تصغير شكل شريط التمرير داخل التقويم ليكون أنيقاً */
.calendar-cell::-webkit-scrollbar { width: 4px; }
.calendar-cell::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 4px; }
:root.light-mode body .calendar-cell::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); }

.calendar-cell:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}

.calendar-cell.today {
    border-color: var(--accent-primary);
    background: rgba(0, 210, 255, 0.05);
}

.calendar-cell.other-month {
    opacity: 0.3;
}

.calendar-day {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.calendar-cell.today .calendar-day {
    color: var(--accent-primary);
}

.calendar-event {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== Waiting List ========== */
.waiting-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    transition: var(--transition);
}

.waiting-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.waiting-number {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.waiting-info {
    flex: 1;
    min-width: 0;
}

.waiting-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.waiting-info p {
    font-size: 12px;
    color: var(--text-muted);
}

.waiting-time {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    flex-shrink: 0;
}

.waiting-time strong {
    display: block;
    font-size: 14px;
    color: var(--warning);
}

/* ========== Loading ========== */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Print Styles ========== */
@media print {
    .sidebar, .top-header, .btn, .no-print {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
    }
    .page-content {
        padding: 0 !important;
    }
    body {
        background: white;
        color: black;
    }
    .card {
        border: 1px solid #ddd;
        background: white;
    }
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }
    .menu-toggle {
        display: block;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
    .header-search {
        display: none;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 15px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-value {
        font-size: 22px;
    }
    .top-header {
        padding: 0 15px;
    }
    .page-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Sidebar Overlay (Mobile) ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========== Animations ========== */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== Tabs ========== */
.tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    border: none;
    background: none;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ========== Filters Bar ========== */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-input {
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
    outline: none;
    min-width: 200px;
}

.filter-input:focus {
    border-color: var(--accent-primary);
}

/* ========== Quick Action Cards ========== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.quick-action:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    background: rgba(0, 210, 255, 0.05);
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.1);
}

.quick-action i {
    font-size: 24px;
    color: var(--accent-primary);
}

.quick-action span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ========== Patient Card ========== */
.patient-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    cursor: pointer;
}

.patient-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.patient-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.patient-avatar.male {
    background: var(--info-bg);
    color: var(--info);
}

.patient-avatar.female {
    background: rgba(236, 72, 153, 0.12);
    color: #ec4899;
}

.patient-details {
    flex: 1;
    min-width: 0;
}

.patient-details h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
}

.patient-details p {
    font-size: 12px;
    color: var(--text-muted);
}

.patient-meta {
    text-align: left;
    flex-shrink: 0;
}

.patient-meta .file-number {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 600;
}

/* ========== Invoice ========== */
.invoice-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px dashed var(--border-color);
}

.invoice-header h2 {
    font-size: 22px;
    margin-bottom: 5px;
}

.invoice-header p {
    color: var(--text-muted);
    font-size: 13px;
}

.invoice-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.invoice-summary {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 12px;
}

/* ========== Quick Actions Dropdown ========== */
.qa-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 44px; /* ليتطابق مع ارتفاع الأزرار المجاورة */
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.qa-toggle-btn:hover {
    color: var(--accent-primary);
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.qa-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    overflow: hidden;
    animation: qaFadeIn 0.15s ease;
    backdrop-filter: blur(20px);
}

.qa-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.qa-menu-item:last-child {
    border-bottom: none;
}

.qa-menu-item:hover {
    background: var(--bg-input);
    color: var(--accent-primary);
}

/* Light Mode Overrides for Quick Actions */
:root.light-mode body .qa-toggle-btn {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #475569;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

:root.light-mode body .qa-toggle-btn:hover {
    background: #f8fafc;
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

@keyframes qaFadeIn { 
    from { opacity: 0; transform: translateY(-6px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* ==========================================
   تحسين القائمة العلوية (Header) على الهاتف
   ========================================== */
@media (max-width: 768px) {
    .top-header {
        padding: 0 10px !important; /* تقليل الحواف الجانبية */
        height: 60px !important; /* تقليل الارتفاع قليلاً */
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* 1. إخفاء التاريخ تماماً على الهاتف لتوفير مساحة */
    .header-date {
        display: none !important;
    }

    /* 2. تحسين منطقة العنوان */
    .header-right {
        gap: 8px !important;
        flex: 1; /* تجعل العنوان يأخذ المساحة المتاحة */
        min-width: 0;
    }

    .page-title {
        font-size: 14px !important; /* تصغير الخط */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* إضافة نقاط إذا كان العنوان طويلاً جداً */
    }

    /* 3. تصغير زر الإجراءات السريعة */
    .qa-toggle-btn {
        padding: 0 8px !important;
        height: 36px !important;
        min-width: 36px;
        justify-content: center;
    }

    /* إخفاء نص "إجراءات سريعة" وإظهار الأيقونة فقط */
    .qa-toggle-btn span {
        display: none !important;
    }

    .qa-toggle-btn i:first-child {
        margin: 0 !important;
        font-size: 16px;
    }

    /* 4. تصغير زر تبديل الثيم */
    .theme-toggle {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }

    /* 5. تصغير زر القائمة الجانبية */
    .menu-toggle {
        width: 36px !important;
        height: 36px !important;
    }
}

/* ========== SweetAlert2 Custom Styling (Theme Compatibility) ========== */
.swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    font-family: 'Cairo', sans-serif !important;
    box-shadow: var(--shadow-lg) !important;
}

.swal2-title {
    color: var(--text-primary) !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
}

.swal2-html-container {
    color: var(--text-secondary) !important;
    padding: 1em 1.6em 0.3em !important;
}

.swal2-confirm {
    background: var(--accent-gradient) !important;
    border-radius: var(--radius-md) !important;
    padding: 10px 24px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px var(--accent-glow) !important;
}

.swal2-cancel {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
}

.swal2-icon.swal2-warning {
    border-color: var(--warning) !important;
    color: var(--warning) !important;
}

.swal2-icon.swal2-error {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

.swal2-icon.swal2-success {
    border-color: var(--success) !important;
    color: var(--success) !important;
}

/* إجبار حقل التاريخ على استخدام الوضع الفاتح */
:root.light-mode .modern-date-group input[type="date"],
body.light-mode .modern-date-group input[type="date"] {
    color-scheme: light !important;
}

/* عكس لون أيقونة التقويم لتصبح سوداء بالإجبار في جميع المتصفحات */
:root.light-mode .modern-date-group input[type="date"]::-webkit-calendar-picker-indicator,
body.light-mode .modern-date-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) grayscale(100%) brightness(0) !important;
    opacity: 0.7 !important;
}