:root {
    --bg-deep: #07090f;
    --bg-surface: #1e293b;
    --accent-blue: #00eaff;
    --accent-glow: #00eaff;
    --sidebar-width: 100px;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(0, 234, 255, 0.15);
    --text-primary: #f3f4f6;
    --text-secondary: #94a3b8;
    --neon-shadow: 0 0 20px rgba(0, 234, 255, 0.2);
    --danger-red: #ef4444;

    /* Theme Abstractions */
    --theme-accent: #00eaff;
    --theme-panel-bg: #1e293b;
    --theme-card-bg: rgba(30, 41, 59, 0.7);
    --theme-border: rgba(0, 234, 255, 0.3);
    --theme-glow: 0 0 30px rgba(0, 234, 255, 0.2);
    --theme-text-accent: #000;
}

/* Backup Guardian Alert */
.backup-alert-banner {
    background: linear-gradient(90deg, #7f1d1d, #ef4444);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 2000;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    font-weight: 700;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    animation: bannerSlideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.backup-alert-banner i {
    animation: pulseIcon 1s infinite alternate;
}

@keyframes bannerSlideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes pulseIcon {
    from {
        opacity: 0.5;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Helper for Pulse Button */
.btn-pulse-danger {
    background: #ef4444 !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 20px !important;
    border-radius: 8px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6) !important;
    transition: 0.3s !important;
}

.btn-pulse-danger:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.8) !important;
}

/* Scroll Navigator */
.scroll-navigator {
    position: fixed;
    left: 30px;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-nav-btn {
    width: 50px;
    height: 50px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(0, 234, 255, 0.3);
    border-radius: 15px;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.scroll-nav-btn:hover {
    opacity: 1;
    transform: translateY(-5px);
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(0, 234, 255, 0.4);
    background: rgba(0, 234, 255, 0.1);
}

.scroll-nav-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
}

@media screen and (max-width: 1024px) {
    .scroll-navigator {
        left: 20px;
        bottom: 110px;
        /* Above bottom nav */
    }

    .scroll-nav-btn {
        width: 45px;
        height: 45px;
    }
}

.doctor-brand-badge {
    background: #0f172a;
    border: 2px solid var(--accent-blue);
    padding: 8px 25px;
    border-radius: 50px;
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    text-shadow: 0 0 10px var(--accent-blue), 0 0 20px var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.3);
    animation: laser-flicker 0.2s infinite alternate;
    font-family: 'Tajawal', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

body {
    font-family: 'Inter', 'Tajawal', sans-serif;
    background: radial-gradient(circle at 50% 50%, #1e293b 0%, #07090f 100%);
    color: var(--text-primary);
    direction: rtl;
    height: 100vh;
    overflow: hidden;
}

/* Layout Structure */
.neuro-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styling */
.neuro-sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.95);
    border-left: 2px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0 0.5rem;
    /* Reduced top/bottom padding */
    gap: 5px;
    margin-bottom: 5px;
}

.sidebar-logo i {
    font-size: 2.8rem;
    color: var(--theme-accent);
    filter: drop-shadow(0 0 15px var(--theme-accent));
}

.sidebar-logo span {
    display: none;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    /* Minimal gap */
    padding: 10px 5px;
    /* Reduced padding */
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.75rem;
    text-align: center;
}

.nav-item i {
    font-size: 1.6rem;
    /* Much larger icons */
    width: auto;
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.3s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateY(-2px);
}

.nav-item:hover i {
    color: var(--theme-accent);
    filter: drop-shadow(0 0 8px var(--theme-accent));
    transform: scale(1.1);
}

.nav-item.active {
    background: rgba(var(--accent-blue-rgb), 0.1);
    color: var(--text-primary);
    border: 1px solid var(--theme-border);
    box-shadow: 0 0 15px rgba(var(--accent-blue-rgb), 0.15) inset;
}

.nav-item.active i {
    color: var(--theme-accent);
    filter: drop-shadow(0 0 12px var(--theme-accent));
}

.sidebar-footer {
    padding: 15px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-link {
    color: #ef4444 !important;
}

.logout-link i {
    color: #ef4444 !important;
    font-size: 1.4rem !important;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Main Content Area */
.neuro-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    height: 100vh;
    overflow: hidden;
    /* Disable main scroll */
    position: relative;
    padding-top: 0;
}

.top-ticker-bar {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--glass-border);
    height: 35px;
    overflow: hidden;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    /* Don't shrink/grow */
    z-index: 100;
    backdrop-filter: blur(10px);
}

.ticker-content {
    white-space: nowrap;
    display: flex;
    animation: ticker-slide 80s linear infinite;
}

.ticker-item {
    color: var(--accent-blue);
    font-weight: 500;
    font-size: 1rem;
    text-shadow: 0 0 15px rgba(0, 234, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 40px;
    padding-left: 50px;
}

.separator-icon {
    font-size: 0.85rem;
    color: #fff;
    filter: drop-shadow(0 0 10px var(--accent-blue));
    opacity: 0.9;
}

@keyframes ticker-slide {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(50%);
    }
}

.top-bar {
    height: 80px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(11, 17, 32, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 2px solid var(--glass-border);
    flex: 0 0 auto;
    /* Don't shrink/grow */
    z-index: 1000;
}

/* Sound Toggle Button in Top Bar */
.btn-sound-toggle {
    background: transparent;
    border: 1px solid rgba(0, 234, 255, 0.3);
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 10px rgba(0, 234, 255, 0.05);
}

.btn-sound-toggle:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.2);
}

.btn-sound-toggle i {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 8px var(--accent-blue));
    transition: transform 0.3s ease;
}

.btn-sound-toggle:hover i {
    transform: scale(1.15);
}

.btn-sound-toggle:active {
    transform: translateY(0);
}


.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: var(--bg-deep);
    border: 2px solid var(--theme-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--theme-accent);
    box-shadow: var(--theme-glow);
}

.user-info h4 {
    color: #fff;
    font-size: 1rem;
}

.user-info span {
    color: #10b981;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-bar {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 350px;
    transition: all 0.3s;
}

.search-bar:focus-within {
    border-color: var(--theme-accent);
    box-shadow: var(--theme-glow);
}

.search-bar i {
    color: var(--theme-accent);
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
}

/* Views & Content */
.view-container {
    padding: 0 40px 40px 40px;
    /* تصفير الحشو العلوي لرفع البطاقات */
    flex: 1;
    /* Take remaining space */
    overflow-y: auto;
    /* Scroll ONLY this area */
    scroll-behavior: smooth;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin: 0 !important;
    /* إزالة كافة الهوامش */
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 101;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--theme-border);
    /* استخدام متغير الحدود للثيم */
}

/* Responsive: 3 columns for medium screens */
@media screen and (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive: 2 columns for tablets */
@media screen and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: 1 column for mobile */
@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    /* Reduced from 20px (additional 5% reduction) */
    padding: 18px;
    /* Reduced from 20px (additional 5% reduction) */
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 12px;
    /* Reduced from 15px (additional 5% reduction) */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    transform: translateY(-8px);
    border-color: var(--theme-accent);
    box-shadow: var(--theme-glow);
}

.stat-icon {
    width: 46px;
    /* Reduced from 50px (additional 5% reduction) */
    height: 46px;
    border-radius: 14px;
    /* Reduced from 15px */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    /* Reduced from 1.5rem (additional 5% reduction) */
    background: var(--bg-deep);
    border: 1px solid var(--theme-border);
    color: var(--theme-accent);
    box-shadow: var(--theme-glow);
}

.stat-info h3 {
    font-size: 1.6rem;
    /* Reduced from 1.7rem (additional 5% reduction) */
    font-weight: 800;
    color: #fff;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    /* Reduced from 0.8rem (additional 5% reduction) */
}

/* Appointment Table / List */
.today-appointments-container {
    background: var(--theme-card-bg);
    /* استخدام متغير خلفية الكروت للثيم */
    border: 1px solid var(--theme-border);
    padding: 15px 20px;
    border-radius: 0 0 20px 20px;
    /* تدوير الحواف السفلية فقط للدمج */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 100px;
    /* المسافة المقدرة لارتفاع البطاقات ليبقى ثابتاً تحتها */
    z-index: 100;
    margin-top: 0 !important;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.neuro-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.neuro-table th {
    text-align: right;
    color: var(--text-secondary);
    padding: 15px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
}

.neuro-table tr {
    transition: all 0.3s;
}

.neuro-table td {
    padding: 20px;
    background: rgba(15, 23, 42, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.neuro-table td:first-child {
    border-radius: 0 15px 15px 0;
    border-right: 1px solid rgba(255, 255, 255, 0.02);
}

.neuro-table td:last-child {
    border-radius: 15px 0 0 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.02);
}

.neuro-table tr:hover td {
    background: rgba(0, 234, 255, 0.05);
    border-color: rgba(0, 234, 255, 0.1);
}

.status-badge {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-confirmed {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Buttons */
.btn-neuro {
    background: #0f172a;
    color: #fff;
    border: 2px solid var(--accent-blue);
    padding: 12px 25px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    text-shadow: 0 0 10px var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.2);
    animation: laser-flicker 0.2s infinite alternate;
}

.btn-neuro:hover {
    background: var(--accent-blue);
    color: #000;
    text-shadow: none;
    box-shadow: 0 0 35px var(--accent-blue);
    transform: translateY(-3px);
}

.btn-edit-tool {
    background: rgba(0, 234, 255, 0.05);
    border: 1px solid rgba(0, 234, 255, 0.2);
    color: var(--accent-blue);
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit-tool:hover {
    background: var(--accent-blue);
    color: #000;
    box-shadow: 0 0 15px var(--accent-blue);
}

@keyframes laser-flicker {
    0% {
        opacity: 0.9;
        box-shadow: 0 0 10px rgba(0, 234, 255, 0.2);
    }

    100% {
        opacity: 1;
        box-shadow: 0 0 25px rgba(0, 234, 255, 0.5);
    }
}

.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 234, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 234, 255, 0.3);
}

/* Autocomplete Suggestions */
.autocomplete-suggestions {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent-blue);
    border-radius: 16px;
    max-height: 400px;
    overflow-y: auto;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 234, 255, 0.1);
    margin-top: 10px;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-item:hover {
    background: rgba(0, 234, 255, 0.1);
}

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

/* Custom Modern Modals */
.neuro-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30000;
}

.neuro-modal-content {
    background: #0f172a;
    border: 2px solid var(--accent-blue);
    border-radius: 28px;
    padding: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 50px rgba(0, 234, 255, 0.2);
    text-align: center;
    animation: modalSlide 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSlide {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.neuro-modal-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(0, 234, 255, 0.4);
}

.neuro-modal-msg {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 35px;
    line-height: 1.6;
}

.neuro-modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-modal-confirm {
    background: var(--accent-blue);
    color: #000 !important;
    border: none;
    padding: 12px 35px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
}

.btn-modal-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 35px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.btn-modal-confirm:hover {
    background: #fff;
    box-shadow: 0 0 20px #fff;
}

/* Print Styles for A4 Report */
@media print {

    .neuro-sidebar,
    .top-ticker-bar,
    .top-bar,
    .btn-neuro,
    .btn-edit-tool,
    .action-buttons,
    .ticker-content {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        overflow: visible !important;
        height: auto !important;
    }

    .neuro-container {
        display: block !important;
    }

    .neuro-main {
        overflow: visible !important;
        padding: 0 !important;
    }

    .view-container {
        padding: 20mm !important;
    }

    .data-card {
        border: none !important;
        background: white !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .neuro-table {
        border-collapse: collapse !important;
        width: 100% !important;
        margin-top: 20px;
    }

    .neuro-table td,
    .neuro-table th {
        background: white !important;
        color: black !important;
        border: 1px solid #ddd !important;
        padding: 12px !important;
        text-align: right !important;
    }

    .status-badge {
        background: none !important;
        border: 1px solid #000 !important;
        color: #000 !important;
    }

    .stat-card {
        display: none !important;
    }

    .report-print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 30px;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }
}

.report-print-header {
    display: none;
}

/* Analog Clock Styling - Premium Chronograph Edition */
.neuro-clock-container {
    position: relative;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, #1e293b 0%, #07090f 100%);
    border: 6px solid #1e293b;
    border-radius: 50%;
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.8),
        inset 0 0 30px rgba(0, 234, 255, 0.1),
        0 0 0 2px rgba(0, 234, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
    overflow: hidden;
}

.neuro-clock-container::before {
    content: "";
    position: absolute;
    top: 5%;
    left: 10%;
    width: 80%;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
    border-radius: 50% 50% 0 0;
    pointer-events: none;
}

.neuro-clock-face {
    position: relative;
    width: 100%;
    height: 100%;
    background:
        repeating-conic-gradient(from 0deg, rgba(0, 234, 255, 0.05) 0deg 1deg, transparent 1deg 30deg);
    border-radius: 50%;
}

.clock-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom;
    border-radius: 4px;
    z-index: 5;
    transition: transform 0.1s cubic-bezier(0.4, 2.08, 0.55, 0.44);
}

.hour-hand {
    width: 8px;
    height: 60px;
    background: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    border-radius: 10px 10px 2px 2px;
}

.minute-hand {
    width: 5px;
    height: 85px;
    background: var(--accent-blue);
    box-shadow: 0 0 20px rgba(0, 234, 255, 0.4);
    border-radius: 10px 10px 2px 2px;
}

.second-hand {
    width: 2px;
    height: 95px;
    background: #ff3e3e;
    box-shadow: 0 0 10px rgba(255, 62, 62, 0.5);
    z-index: 10;
}

.clock-center {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #020617;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    border: 3px solid var(--accent-blue);
    box-shadow: 0 0 15px var(--accent-blue);
}

.clock-mark {
    position: absolute;
    width: 2px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    left: calc(50% - 1px);
    transform-origin: center 110px;
}

/* Position Marks for all 12 hours */
.clock-mark.m1 {
    transform: rotate(30deg);
}

.clock-mark.m2 {
    transform: rotate(60deg);
}

.clock-mark.m3 {
    transform: rotate(90deg);
    background: var(--accent-blue);
    height: 16px;
    width: 4px;
}

.clock-mark.m4 {
    transform: rotate(120deg);
}

.clock-mark.m5 {
    transform: rotate(150deg);
}

.clock-mark.m6 {
    transform: rotate(180deg);
    background: var(--accent-blue);
    height: 16px;
    width: 4px;
}

.clock-mark.m7 {
    transform: rotate(210deg);
}

.clock-mark.m8 {
    transform: rotate(240deg);
}

.clock-mark.m9 {
    transform: rotate(270deg);
    background: var(--accent-blue);
    height: 16px;
    width: 4px;
}

.clock-mark.m10 {
    transform: rotate(300deg);
}

.clock-mark.m11 {
    transform: rotate(330deg);
}

.clock-mark.m12 {
    transform: rotate(0deg);
    background: var(--accent-blue);
    height: 20px;
    width: 5px;
}

/* Header Specific Nav Buttons */
.header-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    height: 48px;
    /* Slightly taller to match search bar better */
    border-radius: 12px;
    /* Slightly less rounded, more like a button */
    background: rgba(255, 255, 255, 0.08);
    /* More visible background */
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    /* Larger font */
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.header-nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.header-nav-btn i {
    font-size: 1.2rem;
}

/* Specific Accent Colors - Now theme Harmonious */
.header-nav-btn[href*="finance"] {
    background: rgba(var(--accent-blue-rgb, 0, 234, 255), 0.1);
    color: var(--accent-blue);
    border-color: rgba(var(--accent-blue-rgb, 0, 234, 255), 0.3);
}

.header-nav-btn[href*="finance"]:hover {
    color: #000 !important;
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px var(--accent-blue);
}

.header-nav-btn[href*="editor"] {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}

.header-nav-btn[href*="editor"]:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.2);
}

/* Modern Clinic Switcher Dropdown */
.clinic-switcher-modern {
    position: relative;
    margin-left: 20px;
    z-index: 2000;
}

.clinic-drop-btn {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 2px solid var(--accent-blue) !important;
    border-radius: 12px !important;
    padding: 8px 18px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    color: var(--accent-blue) !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.1) !important;
    outline: none !important;
}

.clinic-drop-btn:hover {
    background: rgba(0, 234, 255, 0.1);
    box-shadow: 0 0 25px rgba(0, 234, 255, 0.2);
    transform: translateY(-1px);
}

.clinic-drop-btn i {
    font-size: 1.1rem;
}

.clinic-drop-btn .chelsea-icon {
    font-size: 0.8rem;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.clinic-switcher-modern.active .chelsea-icon {
    transform: rotate(180deg);
}

.clinic-drop-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid var(--accent-blue);
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.clinic-switcher-modern.active .clinic-drop-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.clinic-item {
    padding: 14px 18px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
    font-weight: 600;
    border: 1px solid transparent;
}

.clinic-item:hover {
    background: rgba(0, 234, 255, 0.08);
    border-color: rgba(0, 234, 255, 0.2);
    padding-right: 22px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.clinic-item.active {
    background: linear-gradient(135deg, var(--accent-blue), #0099ff);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 234, 255, 0.4);
}

.clinic-item i {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.2));
}

.clinic-item .active-check {
    font-size: 0.9rem;
    animation: scaleCheck 0.3s ease;
}

@keyframes scaleCheck {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* Add a pulse to the icon in the button */
.clinic-drop-btn i:first-child {
    animation: softPulse 2s infinite alternate;
}

@keyframes softPulse {
    from {
        opacity: 0.8;
        filter: drop-shadow(0 0 2px var(--accent-blue));
    }

    to {
        opacity: 1;
        filter: drop-shadow(0 0 8px var(--accent-blue));
    }
}

/* User Badge from AuthManager */
.user-badge {
    background: rgba(15, 23, 42, 0.6);
    padding: 6px 16px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    margin-inline-end: 20px;
}

.user-badge-icon {
    width: 34px;
    height: 34px;
    background: #0f172a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--accent-blue);
    color: var(--accent-blue);
    font-size: 1.1rem;
    filter: drop-shadow(0 0 5px var(--accent-blue));
}

/* Cloud Sync Sensor Styling */
.sync-sensor {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    padding: 6px 15px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    margin-right: 15px;
    transition: all 0.3s ease;
}

.sync-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #64748b;
    /* Offline */
    box-shadow: 0 0 5px #64748b;
    transition: all 0.3s;
}

.sync-sensor.online .sync-status-dot {
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.sync-sensor.syncing .sync-status-dot {
    background: #f59e0b;
    box-shadow: 0 0 10px #f59e0b;
    animation: pulse-sync 1s infinite alternate;
}

.sync-sensor.error .sync-status-dot {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

.sync-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sync-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-latency {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent-blue);
    font-family: monospace;
}

@keyframes pulse-sync {
    from {
        opacity: 0.4;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1.1);
    }
}

.sync-sensor:hover {
    border-color: var(--accent-blue);
    background: rgba(0, 234, 255, 0.05);
    cursor: help;
}

@media screen and (max-width: 1024px) {

    html,
    body {
        height: auto !important;
        min-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        position: relative !important;
        background-attachment: fixed !important;
        -webkit-overflow-scrolling: touch;
    }

    .neuro-container {
        flex-direction: column;
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
    }

    .neuro-main {
        width: 100%;
        height: auto !important;
        overflow: visible !important;
        padding-bottom: 120px !important;
        /* Increased space for fixed bottom nav + safe area */
        display: flex;
        flex-direction: column;
    }

    .view-container {
        padding: 15px !important;
        height: auto !important;
        overflow: visible !important;
    }

    .neuro-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        background: rgba(15, 23, 42, 0.98);
        z-index: 9999;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    }

    .sidebar-logo,
    .sidebar-footer {
        display: none !important;
    }

    /* Logout Button Styling in Mobile Nav */
    .nav-item.logout-link {
        color: #ef4444 !important;
        border-top: none;
    }

    .nav-item.logout-link i {
        color: #ef4444 !important;
    }

    .nav-item.logout-link.active {
        background: rgba(239, 68, 68, 0.1);
        border-top: 3px solid #ef4444 !important;
    }

    .nav-menu {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        gap: 0;
    }

    .nav-item {
        flex: 1;
        border-radius: 0;
        padding: 8px 0;
        font-size: 0.7rem;
        gap: 4px;
    }

    .nav-item i {
        font-size: 1.4rem;
        margin-bottom: 0;
    }

    .nav-item.active {
        border: none;
        border-top: 3px solid var(--accent-blue);
        background: linear-gradient(to bottom, rgba(0, 234, 255, 0.1), transparent);
    }

    /* Top Bar Mobile Optimization */
    .top-bar {
        padding: 0 10px;
        height: 70px;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        background: rgba(11, 17, 32, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        justify-content: center !important;
        /* Center search */
        gap: 10px;
    }

    /* FIX: Hide clinic name on mobile to free up space for search */
    .clinic-switcher-modern {
        display: none !important;
    }

    .search-bar {
        flex: 1 !important;
        max-width: none !important;
        margin: 0 !important;
        display: flex !important;
        /* Force show */
        background: rgba(15, 23, 42, 0.9) !important;
        border: 1px solid var(--accent-blue) !important;
        height: 50px !important;
    }

    .search-bar input {
        width: 100% !important;
        font-size: 1.1rem !important;
        text-align: right !important;
    }

    .top-bar-shortcuts {
        display: none !important;
        /* Hide shortcuts on main top bar for mobile */
    }

    .sync-sensor {
        display: none !important;
        /* Hide tiny sync sensor from top bar */
    }

    .top-ticker-bar {
        display: none !important;
    }

    /* Hide Less Important Elements + Sound/Sync + Desktop Backups */
    .clinic-selector-container,
    .top-bar-shortcuts,
    .sync-sensor,
    #btn-toggle-sound,
    #backup-alert-banner,
    #backup-settings-card {
        display: none !important;
    }

    /* Search Bar - Maximum Visibility on Mobile */
    .search-bar {
        width: 100% !important;
        flex: 2 !important;
        height: 50px;
        padding: 0 15px;
        background: var(--bg-deep);
        border: 2px solid var(--theme-accent) !important;
        border-radius: 14px;
        box-shadow: var(--theme-glow);
    }

    .search-bar input {
        display: block !important;
        width: 100%;
        height: 100%;
        font-size: 1.1rem;
        font-weight: 700;
        color: #fff !important;
    }

    /* Desktop Only Utility - Expanded for tablets */
    .desktop-only {
        display: none !important;
    }

    /* Hide Sync Info Text to save space */
    .sync-info {
        display: none !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 15px;
        border-radius: 16px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .stat-info h3 {
        font-size: 1.5rem;
    }

    .data-card {
        padding: 15px;
        border-radius: 20px;
        overflow: hidden;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-header button {
        width: 100%;
        justify-content: center;
    }

    .neuro-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    .neuro-modal-content {
        width: 95%;
        padding: 20px;
        max-height: 85vh;
        overflow-y: auto;
    }

    .neuro-modal-title {
        font-size: 1.4rem;
    }

    .header-nav-btn span {
        display: none;
    }

    .header-nav-btn {
        padding: 8px;
    }

    /* Hide Specific Nav Items */
    .nav-item[onclick*='queue-display.html'],
    .nav-item[data-view='templates'] {
        display: none !important;
    }

    /* Settings View Mobile Optimizations */
    #view-settings {
        padding: 10px !important;
    }

    #view-settings>div {
        padding: 15px !important;
        margin-top: 15px !important;
    }

    /* Health Status Card Vertical Stack */
    #view-settings>div:first-of-type {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    #view-settings>div:first-of-type div:last-child {
        min-width: 100% !important;
    }

    /* Backup & Security Grids Vertical Stack */
    #view-settings .data-card div[style*='grid-template-columns: 1fr 1fr'],
    #view-settings div[style*='grid-template-columns: 1fr 1fr'] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Users List Grid */
    #users-list-container>div {
        grid-template-columns: 1fr !important;
    }

    /* Clinics Management Grid */
    #clinics-list-container>div {
        grid-template-columns: 1fr !important;
    }

    /* Force all 2-column or multi-column grids and flex containers to stack */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: repeat(2, 1fr)"],
    div[style*="display: grid; grid-template-columns"],
    .modal-content div[style*="display: flex; gap: 30px"],
    .modal-content div[style*="display: flex; gap: 20px"],
    .modal-content div[style*="display: flex; gap: 15px"],
    .stats-grid {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* Modal Content Mobile Fix */
    .modal-content {
        width: 95% !important;
        max-width: 95vw !important;
        padding: 25px 20px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        display: block !important;
    }

    /* Form Fields Full Width */
    .form-group,
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        width: 100% !important;
        max-width: 100% !important;
        margin-inline-start: 0 !important;
    }

    /* Special handling for Gender Toggle */
    .gender-toggle {
        display: flex !important;
        flex-direction: row !important;
    }

    /* Triple name inputs */
    .triple-name-container {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        gap: 10px !important;
    }

    .triple-name-container input {
        width: calc(50% - 5px) !important;
        flex: none !important;
        height: 50px !important;
    }

    /* Action Buttons at the bottom of modals */
    div[style*="flex-direction: row-reverse"],
    div[style*="display: flex; gap: 12px; border-top"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    div[style*="flex-direction: row-reverse"] button,
    div[style*="display: flex; gap: 12px; border-top"] button {
        width: 100% !important;
        height: 55px !important;
    }

    /* Table horizontal scroll */
    .neuro-table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
    }

    /* Patient File Header Adjustment */
    #file-patient-name {
        font-size: 1.5rem !important;
        text-align: center;
    }

    #file-patient-info {
        font-size: 0.85rem !important;
        text-align: center;
    }

    .modal-content>div:first-child[style*="justify-content: space-between"] {
        flex-direction: column !important;
        text-align: center;
        gap: 20px;
    }
}

/* =========================================
   Advanced Themes System (Windows 11 & Luxury Styles)
   ========================================= */

/* --- 1. THEME: DEEP NAVY (Default) --- */
body.theme-blue {
    --bg-deep: #0a192f;
    --bg-surface: #112240;
    --accent-blue: #00eaff;
    --accent-blue-rgb: 0, 234, 255;
    --accent-glow: #00eaff;
    --glass-border: rgba(0, 234, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --neon-shadow: 0 0 20px rgba(0, 234, 255, 0.3);

    /* UI Logic */
    --theme-accent: #00eaff;
    --theme-panel-bg: #112240;
    --theme-card-bg: rgba(10, 25, 47, 0.7);
    --theme-border: rgba(0, 234, 255, 0.4);
    --theme-glow: 0 0 40px rgba(0, 234, 255, 0.3);
    --theme-text-accent: #000;
}

/* --- 2. THEME: MUTED BRONZE (Luxury Night Mode) --- */
body.theme-gold {
    --bg-deep: #1a1612;
    --bg-surface: #26211c;
    --accent-blue: #c5a059;
    /* Muted Bronze/Champagne */
    --accent-glow: #c5a059;
    --glass-border: rgba(197, 160, 89, 0.2);
    --text-primary: #e5e1da;
    --text-secondary: #a8a096;
    --neon-shadow: 0 0 20px rgba(197, 160, 89, 0.1);

    /* UI Logic */
    --theme-accent: #c5a059;
    --theme-panel-bg: #26211c;
    --theme-card-bg: rgba(30, 25, 20, 0.8);
    --theme-border: rgba(197, 160, 89, 0.4);
    --theme-glow: 0 0 40px rgba(197, 160, 89, 0.3);
    --theme-text-accent: #000;
}

body.theme-gold {
    background: radial-gradient(circle at 50% 50%, #26211c 0%, #1a1612 100%);
}

body.theme-gold .neuro-sidebar,
body.theme-gold .top-ticker-bar,
body.theme-gold .top-bar {
    background: rgba(40, 35, 30, 0.96) !important;
    border-color: rgba(197, 160, 89, 0.15) !important;
}

body.theme-gold .btn-neuro {
    background: #26211c;
    color: #c5a059;
    border-color: #c5a059;
    text-shadow: 0 0 5px #c5a059;
    animation: gold-pulse 2s infinite alternate;
}

body.theme-gold .btn-neuro:hover {
    background: #c5a059;
    color: #1a1612;
    box-shadow: 0 0 25px rgba(197, 160, 89, 0.4);
}

@keyframes gold-pulse {
    0% {
        box-shadow: 0 0 10px rgba(197, 160, 89, 0.2);
    }

    100% {
        box-shadow: 0 0 20px rgba(197, 160, 89, 0.4);
    }
}

/* =========================================
   ألوان الأيقونات الفردية - ثيم Deep Navy (Blue)
   ========================================= */

/* اللوجو - Neon سيان */
body.theme-blue .sidebar-logo i {
    color: #00eaff !important;
    filter: drop-shadow(0 0 10px rgba(0, 234, 255, 0.8)) !important;
}

/* الرئيسية - أزرق سماوي نيون */
body.theme-blue .nav-item[data-view="dashboard"] i {
    color: #38bdf8 !important;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6)) !important;
}

body.theme-blue .nav-item[data-view="dashboard"] span {
    color: #7dd3fc;
}

/* سجلات المرضى - أخضر زمردي */
body.theme-blue .nav-item[data-view="patients"] i {
    color: #34d399 !important;
    filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.6)) !important;
}

body.theme-blue .nav-item[data-view="patients"] span {
    color: #6ee7b7;
}

/* جدول المواعيد - ذهبي عنبري */
body.theme-blue .nav-item[data-view="appointments"] i {
    color: #fbbf24 !important;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5)) !important;
}

body.theme-blue .nav-item[data-view="appointments"] span {
    color: #fcd34d;
}

/* الإعدادات - فضي لامع */
body.theme-blue .nav-item[data-view="settings"] i {
    color: #94a3b8 !important;
    filter: drop-shadow(0 0 6px rgba(148, 163, 184, 0.4)) !important;
}

body.theme-blue .nav-item[data-view="settings"] span {
    color: #cbd5e1;
}

/* شاشة الانتظار - بنفسجي نيون */
body.theme-blue .nav-item[onclick*="queue-display"] i {
    color: #a78bfa !important;
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.6)) !important;
}

body.theme-blue .nav-item[onclick*="queue-display"] span {
    color: #c4b5fd;
}

/* التوصيات العلاجية - تركواز حيوي */
body.theme-blue .nav-item[data-view="templates"] i {
    color: #22d3ee !important;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.6)) !important;
}

body.theme-blue .nav-item[data-view="templates"] span {
    color: #67e8f9;
}

/* =========================================
   ألوان الأيقونات الفردية - ثيم Muted Bronze (Gold)
   ========================================= */

/* اللوجو - ذهبي ملكي */
body.theme-gold .sidebar-logo i {
    color: #f59e0b !important;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.7)) !important;
}

/* الرئيسية - ذهبي دافئ */
body.theme-gold .nav-item[data-view="dashboard"] i {
    color: #fbbf24 !important;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5)) !important;
}

body.theme-gold .nav-item[data-view="dashboard"] span {
    color: #fcd34d;
}

/* سجلات المرضى - أخضر ترابي دافئ */
body.theme-gold .nav-item[data-view="patients"] i {
    color: #4ade80 !important;
    filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.4)) !important;
}

body.theme-gold .nav-item[data-view="patients"] span {
    color: #86efac;
}

/* جدول المواعيد - برتقالي ذهبي */
body.theme-gold .nav-item[data-view="appointments"] i {
    color: #fb923c !important;
    filter: drop-shadow(0 0 8px rgba(251, 146, 60, 0.5)) !important;
}

body.theme-gold .nav-item[data-view="appointments"] span {
    color: #fdba74;
}

/* الإعدادات - فضي دافئ */
body.theme-gold .nav-item[data-view="settings"] i {
    color: #a8a096 !important;
    filter: drop-shadow(0 0 5px rgba(168, 160, 150, 0.3)) !important;
}

body.theme-gold .nav-item[data-view="settings"] span {
    color: #c8c0b5;
}

/* شاشة الانتظار - وردي بنفسجي */
body.theme-gold .nav-item[onclick*="queue-display"] i {
    color: #e879f9 !important;
    filter: drop-shadow(0 0 8px rgba(232, 121, 249, 0.4)) !important;
}

body.theme-gold .nav-item[onclick*="queue-display"] span {
    color: #f0abfc;
}

/* التوصيات العلاجية - تركواز عميق */
body.theme-gold .nav-item[data-view="templates"] i {
    color: #2dd4bf !important;
    filter: drop-shadow(0 0 8px rgba(45, 212, 191, 0.4)) !important;
}

body.theme-gold .nav-item[data-view="templates"] span {
    color: #5eead4;
}



/* --- 4. THEME: CLEAR ALABASTER (Inverted Slate Rock) --- */
body.theme-royal {
    --bg-deep: #f1f5f9;
    /* Light Slate */
    --bg-surface: #ffffff;
    /* Pure White */
    --accent-blue: #1e293b;
    /* Midnight Navy */
    --accent-glow: #1e293b;
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-primary: #020617;
    /* Very Deep Black-Navy for Names */
    --text-secondary: #334155;
    /* Solid Slate for Secondary */
    --neon-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* UI Logic */
    --theme-accent: #1e293b;
    --theme-panel-bg: #ffffff;
    --theme-card-bg: #f8fafc;
    --theme-border: rgba(0, 0, 0, 0.1);
    --theme-glow: 0 10px 40px rgba(0, 0, 0, 0.05);
    --theme-text-accent: #fff;
}

body.theme-royal {
    background: #f1f5f9;
    color: #0f172a;
}

body.theme-royal .neuro-sidebar {
    background: #ffffff !important;
    border-left: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

body.theme-royal .top-bar,
body.theme-royal .top-ticker-bar {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

body.theme-royal .stat-card,
body.theme-royal .data-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

body.theme-royal .stat-card:hover {
    border-color: #1e293b !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-5px);
}

body.theme-royal .stat-info h3,
body.theme-royal .section-header h2 {
    color: #1e293b;
}

body.theme-royal .nav-item {
    color: #475569;
}

body.theme-royal .nav-item:hover,
body.theme-royal .nav-item.active {
    background: rgba(30, 41, 59, 0.05);
    color: #0f172a;
    border-color: #1e293b;
}

body.theme-royal .btn-neuro {
    background: #0f172a !important;
    color: #ffffff !important;
    border: none !important;
    text-shadow: none !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2) !important;
    animation: none !important;
}

body.theme-royal .btn-neuro:hover {
    background: #1e293b !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(15, 23, 42, 0.3) !important;
}

body.theme-royal .neuro-table td {
    background: #ffffff;
    border-color: #f1f5f9;
    color: #000000;
    font-weight: 500;
}

/* Bold Names in Table for visibility */
body.theme-royal .neuro-table td:first-child,
body.theme-royal .patient-name {
    font-weight: 800 !important;
    color: #000000 !important;
}

body.theme-royal .nav-item {
    font-weight: 700;
}

/* ألوان الأيقونات الفردية - ثيم Royal الفاتح */

/* الرئيسية - أزرق سماوي */
body.theme-royal .nav-item[data-view="dashboard"] i {
    color: #0ea5e9 !important;
    filter: drop-shadow(0 2px 6px rgba(14, 165, 233, 0.3)) !important;
}

/* سجلات المرضى - أخضر صحي */
body.theme-royal .nav-item[data-view="patients"] i {
    color: #10b981 !important;
    filter: drop-shadow(0 2px 6px rgba(16, 185, 129, 0.3)) !important;
}

/* جدول المواعيد - ذهبي برتقالي */
body.theme-royal .nav-item[data-view="appointments"] i {
    color: #f59e0b !important;
    filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.3)) !important;
}

/* الإعدادات - رمادي رصاصي أنيق */
body.theme-royal .nav-item[data-view="settings"] i {
    color: #64748b !important;
    filter: drop-shadow(0 2px 4px rgba(100, 116, 139, 0.25)) !important;
}

/* شاشة الانتظار - بنفسجي */
body.theme-royal .nav-item[onclick*="queue-display"] i {
    color: #8b5cf6 !important;
    filter: drop-shadow(0 2px 6px rgba(139, 92, 246, 0.3)) !important;
}

/* التوصيات العلاجية - تركواز طبي */
body.theme-royal .nav-item[data-view="templates"] i {
    color: #06b6d4 !important;
    filter: drop-shadow(0 2px 6px rgba(6, 182, 212, 0.3)) !important;
}

/* اللوجو (Brain) - بنفسجي طبي */
body.theme-royal .sidebar-logo i {
    color: #6366f1 !important;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.35)) !important;
}

/* ألوان النصوص المقابلة لكل أيقونة */
body.theme-royal .nav-item[data-view="dashboard"] span {
    color: #0369a1;
}

body.theme-royal .nav-item[data-view="patients"] span {
    color: #065f46;
}

body.theme-royal .nav-item[data-view="appointments"] span {
    color: #92400e;
}

body.theme-royal .nav-item[data-view="settings"] span {
    color: #475569;
}

body.theme-royal .nav-item[onclick*="queue-display"] span {
    color: #5b21b6;
}

body.theme-royal .nav-item[data-view="templates"] span {
    color: #0e7490;
}

body.theme-royal .search-bar {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.theme-royal .search-bar input {
    color: #0f172a !important;
}

body.theme-royal .search-bar input::placeholder {
    color: #64748b !important;
    opacity: 1;
}

body.theme-royal .search-bar i {
    color: #334155 !important;
}

/* Fix Visibility: Remove Glows in Light Theme */
body.theme-royal *,
body.theme-royal strong,
body.theme-royal span,
body.theme-royal h2,
body.theme-royal h3 {
    text-shadow: none !important;
}

body.theme-royal .neuro-table td strong {
    color: #020617 !important;
    /* Extremely Dark Navy */
    font-weight: 800;
}

body.theme-royal .ticker-item span,
body.theme-royal .ticker-item i {
    color: #0f172a !important;
    text-shadow: none !important;
}

body.theme-royal .stat-info h3 {
    color: #0f172a !important;
    text-shadow: none !important;
}

body.theme-royal .theme-menu {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

body.theme-royal .theme-option {
    color: #1e293b !important;
}

body.theme-royal .theme-option:hover {
    background: #f1f5f9 !important;
}

/* Mobile Utilities */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

/* Securing Overlay (Full-screen backup animation) */
.securing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: radial-gradient(circle at center, #1e293b 0%, #07090f 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.5s ease-in-out;
}

.securing-content {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.securing-icon {
    font-size: 5rem;
    color: var(--accent-blue);
    margin-bottom: 25px;
    filter: drop-shadow(0 0 20px rgba(0, 234, 255, 0.4));
}

.securing-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 234, 255, 0.1);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.2);
}

.securing-title {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.securing-status {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   ألوان الأيقونات الفردية - الشريط العلوي (Top Bar)
   ========================================= */

/* --- Theme Deep Navy (Blue) --- */
body.theme-blue .clinic-drop-btn i {
    color: #00eaff !important;
    filter: drop-shadow(0 0 8px rgba(0, 234, 255, 0.6)) !important;
}

body.theme-blue .search-bar i.fa-magnifying-glass {
    color: #94a3b8 !important;
}

body.theme-blue .header-nav-btn[href*="editor"] i {
    color: #22d3ee !important;
    filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.5)) !important;
}

body.theme-blue .header-nav-btn[href*="finance"] i {
    color: #fbbf24 !important;
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.5)) !important;
}

body.theme-blue #btn-theme-switcher i {
    color: #a78bfa !important;
    filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.5)) !important;
}

body.theme-blue #btn-toggle-sound i {
    color: #34d399 !important;
    filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.5)) !important;
}

body.theme-blue #btn-help-center i {
    color: #f87171 !important;
    filter: drop-shadow(0 0 6px rgba(248, 113, 113, 0.5)) !important;
}

body.theme-blue .sync-sensor button i {
    color: #38bdf8 !important;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5)) !important;
}

/* --- Theme Muted Bronze (Gold) --- */
body.theme-gold .clinic-drop-btn i {
    color: #f59e0b !important;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6)) !important;
}

body.theme-gold .search-bar i.fa-magnifying-glass {
    color: #a8a096 !important;
}

body.theme-gold .header-nav-btn[href*="editor"] i {
    color: #2dd4bf !important;
    filter: drop-shadow(0 0 6px rgba(45, 212, 191, 0.4)) !important;
}

body.theme-gold .header-nav-btn[href*="finance"] i {
    color: #fb923c !important;
    filter: drop-shadow(0 0 6px rgba(251, 146, 60, 0.5)) !important;
}

body.theme-gold #btn-theme-switcher i {
    color: #e879f9 !important;
    filter: drop-shadow(0 0 6px rgba(232, 121, 249, 0.4)) !important;
}

body.theme-gold #btn-toggle-sound i {
    color: #4ade80 !important;
    filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.4)) !important;
}

body.theme-gold #btn-help-center i {
    color: #fb7185 !important;
    filter: drop-shadow(0 0 6px rgba(251, 113, 133, 0.4)) !important;
}

body.theme-gold .sync-sensor button i {
    color: #fbbf24 !important;
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.4)) !important;
}

/* --- Theme Clear Alabaster (Royal) --- */
body.theme-royal .clinic-drop-btn i {
    color: #6366f1 !important;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.2)) !important;
}

/* Any non-overriden search bar icons are covered earlier in royal css */
body.theme-royal .header-nav-btn[href*="editor"] i {
    color: #06b6d4 !important;
    filter: drop-shadow(0 2px 4px rgba(6, 182, 212, 0.2)) !important;
}

body.theme-royal .header-nav-btn[href*="editor"] span {
    color: #1e3a8a !important;
    /* كحلي */
    font-weight: 800 !important;
    /* عريض */
}

body.theme-royal .header-nav-btn[href*="finance"] i {
    color: #d97706 !important;
    filter: drop-shadow(0 2px 4px rgba(217, 119, 6, 0.2)) !important;
}

body.theme-royal #btn-theme-switcher i {
    color: #8b5cf6 !important;
    filter: drop-shadow(0 2px 4px rgba(139, 92, 246, 0.2)) !important;
}

body.theme-royal #btn-toggle-sound i {
    color: #059669 !important;
    filter: drop-shadow(0 2px 4px rgba(5, 150, 105, 0.2)) !important;
}

body.theme-royal #btn-help-center i {
    color: #e11d48 !important;
    filter: drop-shadow(0 2px 4px rgba(225, 29, 72, 0.2)) !important;
}

body.theme-royal .sync-sensor button i {
    color: #0284c7 !important;
    filter: drop-shadow(0 2px 4px rgba(2, 132, 199, 0.2)) !important;
}