/* ==========================================================================
   منصة مستوصف البترجي الطبي – فرعا مكة المكرمة
   Design System & Mobile-First Stylesheet (RTL Support)
   ========================================================================== */

:root {
    --primary-color: #084c61;
    --primary-hover: #063949;
    --primary-light: #e6f6f8;
    --secondary-color: #0d9488;
    --secondary-hover: #0f766e;
    --accent-color: #10b981;
    --dark-color: #0f172a;
    --light-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --info-color: #0284c7;
    --hero-gradient: linear-gradient(135deg, #042732 0%, #084c61 45%, #0b6e8e 75%, #0d9488 100%);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 5px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.12);
    --transition: all 0.25s ease-in-out;
    --font-main: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background-color: var(--light-color);
    color: var(--text-primary);
    line-height: 1.65;
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Layout Elements */
.container {
    width: 100%;
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.main-content {
    flex: 1;
}

/* Top Bar */
.top-bar {
    background: #064052;
    color: #e2e8f0;
    font-size: 0.85rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.top-bar-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.top-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Main Navbar */
.site-header {
    background: var(--surface-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    flex-wrap: nowrap;
    gap: 1rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(11, 110, 142, 0.3);
    flex-shrink: 0;
}

.brand-text {
    white-space: nowrap;
}

.brand-text h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.1;
    white-space: nowrap;
}

.brand-text span {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.nav-menu {
    display: none;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    flex-wrap: nowrap;
    white-space: nowrap !important;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap !important;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap !important;
    word-break: keep-all !important;
    font-weight: 600;
    color: var(--dark-color);
    padding: 0.45rem 0.65rem;
    border-radius: 8px; /* مستطيل بحواف دائرية أنيقة لتمييز العنصر */
    border: 1.5px solid transparent;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.88rem;
    line-height: 1;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(11, 110, 142, 0.08);
    border-color: rgba(11, 110, 142, 0.3); /* مستطيل بحواف دائرية حول العنصر */
    box-shadow: 0 2px 8px rgba(11, 110, 142, 0.12);
    transform: translateY(-1px);
}

.nav-link.active {
    color: var(--primary-color);
    font-weight: 700;
    background: rgba(11, 110, 142, 0.12);
    border-color: rgba(11, 110, 142, 0.4);
    box-shadow: 0 2px 6px rgba(11, 110, 142, 0.15);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.btn-hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--dark-color);
    border-radius: 2px;
    transition: var(--transition);
}

/* Mobile Drawer */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    height: 100%;
    height: 100dvh;
    background: var(--surface-color);
    z-index: 2000;
    box-shadow: -8px 0 35px rgba(0, 0, 0, 0.35);
    padding: 1.25rem 1.25rem 2.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
    transform: translateX(110%) !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.32s ease;
}

.mobile-drawer.open {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

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

.drawer-brand {
    flex: 1;
    overflow: hidden;
}

.drawer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.drawer-close {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.12);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    padding: 0;
    font-size: 1.3rem;
    line-height: 1;
    z-index: 10;
}

.drawer-close * {
    pointer-events: none;
}

.drawer-close:hover,
.drawer-close:active {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    transform: scale(1.08);
}

html[data-theme="dark"] .drawer-close {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #f8fafc;
}

html[data-theme="dark"] .drawer-close:hover,
html[data-theme="dark"] .drawer-close:active {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.mobile-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
    color: var(--dark-color);
    transition: all 0.2s ease;
    text-decoration: none;
    touch-action: manipulation;
}

.mobile-nav-link i,
.mobile-nav-link svg {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
    flex-shrink: 0;
    pointer-events: none;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: translateX(-4px);
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1999;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-align: center;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0e8ab2);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(11, 110, 142, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(11, 110, 142, 0.35);
}

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

.btn-secondary:hover {
    background: var(--secondary-hover);
    color: #ffffff;
}

.btn-outline {
    background: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: #ffffff;
}

.btn-light {
    background: #ffffff;
    color: var(--dark-color);
    border-color: var(--border-color);
}

.btn-light:hover {
    background: #f1f5f9;
    color: var(--dark-color) !important;
    border-color: #cbd5e1;
}

/* Patient Sub-navigation (شريط تنقل بوابة المريض) */
.patient-subnav {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.patient-subnav .container {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    align-items: center;
}

.patient-subnav a.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition);
}

/* Active Tab in Patient Nav (مواعيدي وحجوزاتي عند تفعيلها) */
.patient-subnav a.btn.btn-primary,
.patient-subnav a.btn.active {
    background: var(--primary-color) !important;
    color: #ffffff !important;
    border: 1px solid var(--primary-color) !important;
    box-shadow: 0 2px 6px rgba(8, 76, 97, 0.25);
}

.patient-subnav a.btn.btn-primary:hover,
.patient-subnav a.btn.active:hover {
    background: var(--primary-hover) !important;
    color: #ffffff !important;
    border-color: var(--primary-hover) !important;
}

.patient-subnav a.btn.btn-primary i,
.patient-subnav a.btn.active i {
    color: #ffffff !important;
}

/* Inactive Tabs in Patient Nav */
.patient-subnav a.btn.btn-light {
    background: #ffffff !important;
    color: var(--dark-color) !important;
    border: 1px solid var(--border-color) !important;
}

.patient-subnav a.btn.btn-light:hover {
    background: var(--primary-light) !important;
    color: var(--primary-color) !important;
    border-color: #b9e6ed !important;
}

.patient-subnav a.btn.btn-light:hover i {
    color: var(--primary-color) !important;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

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

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--radius-full);
}

.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-indigo  { background: #e0e7ff; color: #3730a3; }
.badge-dark    { background: #334155; color: #ffffff; }

/* Alerts */
.alert {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Cards & Grid */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

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

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

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

/* ==========================================================================
   Subpage Headers & Signature Hero Gradient Branding
   ========================================================================== */
.section-title-wrapper {
    text-align: center;
    margin-bottom: 2.75rem;
    position: relative;
}

.section-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0d9488;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    margin-bottom: 0.85rem;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.08);
}

.section-title {
    font-size: 2.15rem;
    font-weight: 900;
    color: var(--dark-color);
    margin-bottom: 0.75rem;
    line-height: 1.35;
    letter-spacing: -0.5px;
}

.section-desc {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.75;
}

/* التدرج اللوني الفاخر المشابه للهيروسيكشن أسفل النص في كل الصفحات الفرعية */
.section-title-wrapper::after {
    content: '';
    display: block;
    width: 160px;
    height: 5px;
    margin: 1.35rem auto 0;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #052e3d 0%, #084c61 30%, #0d9488 70%, #10b981 100%);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.45);
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-title-wrapper:hover::after {
    width: 220px;
}

/* محاذاة التدرج في حال كان النص محاذى لليمين */
.section-title-wrapper[style*="text-align: right"]::after,
.section-title-wrapper.text-right::after {
    margin: 1.25rem 0 0 auto;
}

/* ==========================================================================
   Subpage Hero Banner (The Exact Gradient from User's Image)
   Colors: #042e36 -> #053940 -> #063f51 -> #084b60 -> #0a6a89
   ========================================================================== */
.subpage-hero {
    background: linear-gradient(135deg, #042e36 0%, #053940 25%, #063f51 50%, #084b60 75%, #0a6a89 100%);
    color: #ffffff;
    padding: 3.75rem 1rem 3.5rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 2.75rem;
    box-shadow: 0 8px 24px rgba(4, 46, 54, 0.35);
}

/* Ambient glow overlay */
.subpage-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(10, 106, 137, 0.4) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    filter: blur(50px);
}

.subpage-hero::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    filter: blur(60px);
}

.subpage-hero .container {
    position: relative;
    z-index: 2;
    text-align: center;
}

.subpage-hero .subpage-badge,
.subpage-hero .section-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 0.4rem 1.15rem;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 700;
    color: #a7f3d0;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.subpage-hero .subpage-title,
.subpage-hero .section-title {
    font-size: 2.35rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 0.85rem;
    line-height: 1.35;
    letter-spacing: -0.5px;
}

.subpage-hero .subpage-desc,
.subpage-hero .section-desc {
    font-size: 1.1rem;
    color: #e2e8f0;
    max-width: 720px;
    margin: 0 auto;
    line-height: 1.8;
}

.subpage-hero-accent {
    width: 140px;
    height: 4px;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #10b981, #38bdf8);
    margin: 1.35rem auto 0;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.5);
    transition: width 0.3s ease;
}

.subpage-hero:hover .subpage-hero-accent {
    width: 200px;
}

@media (max-width: 768px) {
    .subpage-hero {
        padding: 2.75rem 1rem 2.5rem;
        margin-bottom: 2rem;
    }
    .subpage-hero .subpage-title,
    .subpage-hero .section-title {
        font-size: 1.85rem;
    }
    .subpage-hero .subpage-desc,
    .subpage-hero .section-desc {
        font-size: 0.98rem;
    }
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #07475d 0%, #0b6e8e 60%, #16a085 100%);
    color: #ffffff;
    padding: 3rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.hero-content {
    text-align: center;
}

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #e0f2fe;
}

.hero-title {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 1rem;
    color: #ffffff;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: #e2e8f0;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

/* Quick Booking Bar */
.quick-booking-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    margin-top: -2.5rem;
    position: relative;
    z-index: 10;
    border: 1px solid var(--border-color);
}

.quick-booking-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.15rem;
}

.form-label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--dark-color);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    color: var(--text-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(11, 110, 142, 0.15);
}

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

.form-control.is-invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

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

.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.text-muted { color: var(--text-muted); }

/* Tables Responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th, .table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.table th {
    background-color: #f8fafc;
    font-weight: 700;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Sections */
.section {
    padding: 3.5rem 0;
}

.section-title-wrapper {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.section-subtitle {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.section-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--dark-color);
}

.section-desc {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Doctor Card */
.doctor-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.doctor-avatar {
    width: 100%;
    height: 270px;
    background: #f1f5f9;
    position: relative;
    overflow: hidden;
    display: block;
    margin: 0;
    padding: 0;
    border-radius: 0;
}

.doctor-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
    border-radius: 0 !important;
    display: block !important;
    transition: transform 0.4s ease;
}

.doctor-card:hover .doctor-avatar img {
    transform: scale(1.04);
}

.doctor-avatar-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #084c61, #0d9488);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 800;
    border-radius: 0;
}

/* Branch Card */
.branch-card {
    position: relative;
    overflow: hidden;
}

.branch-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 5;
}

/* Footer */
.site-footer {
    background: #0d1e27;
    color: #94a3b8;
    padding-top: 3.5rem;
    margin-top: auto;
    border-top: 3px solid var(--primary-color);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    color: #ffffff;
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 35px;
    height: 2px;
    background: var(--secondary-color);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.6rem;
}

.footer-links a {
    color: #94a3b8;
    transition: var(--transition);
}

.footer-links a:hover {
    color: #ffffff;
    padding-right: 5px;
}

.footer-bottom {
    background: #071218;
    padding: 1.25rem 0;
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

/* ==========================================================================
   Hero Section & Doctor Blend Styles
   ========================================================================== */
.hero-section {
    position: relative;
    background: var(--hero-gradient);
    color: #ffffff;
    padding: 4.5rem 0 3.5rem;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -15%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.22) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    filter: blur(50px);
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -15%;
    right: -5%;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.18) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    filter: blur(60px);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    color: #a7f3d0;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.hero-title {
    font-size: 2.1rem;
    font-weight: 900;
    line-height: 1.35;
    color: #ffffff;
    margin-bottom: 1.25rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #e2e8f0;
    margin-bottom: 2rem;
    max-width: 620px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.25rem;
}

.hero-trust-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 580px;
}

.trust-stat-item {
    display: flex;
    flex-direction: column;
}

.trust-stat-num {
    font-size: 1.45rem;
    font-weight: 900;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trust-stat-label {
    font-size: 0.8rem;
    color: #cbd5e1;
}

.hero-image-col {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-doctor-wrapper {
    position: relative;
    width: 100%;
    max-width: 440px;
    border-radius: 28px;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.18), rgba(8, 76, 97, 0.45));
    padding: 8px;
}

.hero-doctor-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15);
    /* Seamless blend with background gradient */
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 82%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 82%, rgba(0,0,0,0) 100%);
    transition: transform 0.4s ease;
}

.hero-doctor-wrapper:hover .hero-doctor-img {
    transform: translateY(-4px) scale(1.01);
}

.floating-hero-badge {
    position: absolute;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 3;
    animation: floatSlow 4s ease-in-out infinite alternate;
}

.floating-badge-top {
    top: -12px;
    right: -12px;
}

.floating-badge-bottom {
    bottom: 20px;
    left: -12px;
    animation-delay: 2s;
}

@keyframes floatSlow {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-8px); }
}

/* ==========================================================================
   Offers Cards & Visuals
   ========================================================================== */
.offer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
}

.offer-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.offer-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 30px -10px rgba(8, 76, 97, 0.15);
    border-color: #99f6e4;
}

.offer-image-box {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #084c61, #0d9488);
}

.offer-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.offer-card:hover .offer-image-box img {
    transform: scale(1.08);
}

.offer-badge-floating {
    position: absolute;
    top: 14px;
    right: 14px;
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: #ffffff;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.35);
    z-index: 2;
}

.offer-branch-floating {
    position: absolute;
    bottom: 12px;
    right: 14px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    z-index: 2;
}

.offer-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.offer-title {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    font-weight: 800;
}

.offer-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.65;
    margin-bottom: 1.25rem;
    flex: 1;
}

.offer-price-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

.offer-current-price {
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--dark-color);
}

.offer-old-price {
    font-size: 1.05rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.offer-save-badge {
    background: #ecfdf5;
    color: #059669;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    margin-right: auto;
}

/* ==========================================================================
   PWA Installation UI & Floating Bottom-Right Button
   ========================================================================== */
.pwa-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: none; /* Controlled by JS / PWA events */
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.7rem 1.25rem;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 25px rgba(5, 150, 105, 0.45), 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: pwaFloatPulse 3s infinite ease-in-out;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
    text-decoration: none;
}

.pwa-floating-btn:hover {
    transform: translateY(-3px) scale(1.03);
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    box-shadow: 0 14px 30px rgba(5, 150, 105, 0.55), 0 6px 16px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.75);
    color: #ffffff !important;
}

.pwa-floating-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.pwa-floating-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
}

.pwa-floating-icon i,
.pwa-floating-icon svg {
    width: 16px;
    height: 16px;
    color: #ffffff;
}

.pwa-floating-text {
    font-weight: 700;
    letter-spacing: -0.01em;
}

@keyframes pwaFloatPulse {
    0%, 100% {
        box-shadow: 0 10px 25px rgba(5, 150, 105, 0.45), 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    50% {
        box-shadow: 0 14px 30px rgba(5, 150, 105, 0.55), 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

.pwa-drawer-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #ffffff !important;
    font-weight: 700;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
    cursor: pointer;
    border: none;
    text-align: center;
    width: 100%;
}

.pwa-install-banner {
    position: fixed;
    bottom: -160px;
    left: 1.25rem;
    right: 1.25rem;
    max-width: 520px;
    margin: 0 auto;
    background: rgba(8, 44, 56, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-install-banner.visible {
    bottom: 1.5rem;
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.pwa-banner-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-banner-text {
    flex: 1;
}

.pwa-banner-title {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
    color: #ffffff;
}

.pwa-banner-sub {
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.35;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pwa-btn-install {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #ffffff;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.pwa-btn-install:hover {
    transform: translateY(-2px);
}

.pwa-btn-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.35rem;
    padding: 0.25rem;
    line-height: 1;
}

/* ==========================================================================
   Article Featured Image & Cards
   ========================================================================== */
.article-featured-image-wrapper {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    background: linear-gradient(135deg, #052e3d, #084c61, #0d9488);
}

.article-featured-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.article-image-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
}

.article-card-image-box {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #084c61, #0d9488);
}

.article-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover .article-card-thumb {
    transform: scale(1.08);
}

.article-card-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
}

@media (max-width: 768px) {
    .article-featured-image-wrapper {
        height: 240px;
    }
}

/* ==========================================================================
   Responsive Media Queries
   ========================================================================== */
@media (min-width: 576px) {
    .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-booking-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .offer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.75rem; }
    .hero-title { font-size: 2.75rem; }
    .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-booking-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
    .nav-menu { display: flex; }
    .btn-hamburger { display: none; }
    .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.5fr; }
    .hero-grid {
        grid-template-columns: 1.15fr 0.85fr;
        gap: 3rem;
    }
}

/* Ensure navbar items never wrap into two lines between 992px and 1220px */
@media (min-width: 992px) and (max-width: 1220px) {
    .nav-menu {
        gap: 0.2rem;
    }
    .nav-menu li {
        white-space: nowrap !important;
    }
    .nav-link {
        font-size: 0.82rem;
        padding: 0.35rem 0.45rem;
        border-radius: 6px;
        white-space: nowrap !important;
        word-break: keep-all !important;
    }
    .brand-text h2 {
        font-size: 1.02rem;
    }
    .brand-text span {
        display: none;
    }
    .nav-actions {
        gap: 0.35rem;
    }
    .nav-actions .btn {
        padding: 0.4rem 0.65rem;
        font-size: 0.82rem;
    }
}

@media (min-width: 1200px) {
    .offer-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ==========================================================================
   Hide all PWA install buttons and banners when app is installed (standalone)
   ========================================================================== */
@media all and (display-mode: standalone) {
    #pwaFloatingInstallBtn,
    .pwa-floating-btn,
    .pwa-install-banner,
    .pwa-drawer-btn,
    .pwa-nav-btn {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* ==========================================================================
   Ultra-Fast Navigation Bar & Sidebar Immediate Feedback
   ========================================================================== */
#appTopProgressBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #0d9488, #38bdf8, #10b981);
    z-index: 999999;
    box-shadow: 0 0 10px rgba(13, 148, 136, 0.8), 0 0 5px rgba(56, 189, 248, 0.6);
    transition: width 0.3s cubic-bezier(0.1, 0.7, 0.1, 1), opacity 0.2s ease;
    pointer-events: none;
    opacity: 0;
}

#appTopProgressBar.loading {
    opacity: 1;
    width: 75%;
}

#appTopProgressBar.finishing {
    opacity: 1;
    width: 100%;
}

.sidebar-menu a.nav-loading,
.mobile-nav-link.nav-loading,
.patient-subnav a.nav-loading {
    background: rgba(13, 148, 136, 0.45) !important;
    color: #ffffff !important;
    position: relative;
    opacity: 0.9;
}

.sidebar-menu a.nav-loading::after,
.patient-subnav a.nav-loading::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    margin-right: auto;
    animation: spin 0.6s linear infinite;
}

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

/* ==========================================================================
   نظام الوضع الليلي المتطور (Universal Dark Mode Engine)
   ========================================================================== */
html[data-theme="dark"] {
    --light-color: #0b1329;
    --surface-color: #111e38;
    --dark-color: #060b18;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1e3256;
    --primary-light: rgba(14, 165, 233, 0.16);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
}

html[data-theme="dark"] body {
    background-color: var(--light-color);
    color: var(--text-primary);
}

html[data-theme="dark"] .site-header {
    background: rgba(17, 30, 56, 0.95);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .top-bar {
    background: #060b18;
    border-bottom: 1px solid #172545;
}

html[data-theme="dark"] .quick-booking-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .specialty-card,
html[data-theme="dark"] .doctor-card,
html[data-theme="dark"] .service-card,
html[data-theme="dark"] .article-card,
html[data-theme="dark"] .offer-card,
html[data-theme="dark"] .faq-card,
html[data-theme="dark"] .review-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .patient-card {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .quick-booking-card h3,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] h1, 
html[data-theme="dark"] h2, 
html[data-theme="dark"] h3, 
html[data-theme="dark"] h4, 
html[data-theme="dark"] h5 {
    color: #ffffff;
}

html[data-theme="dark"] .form-control {
    background: #0d172e;
    border-color: #233860;
    color: #f8fafc;
}

html[data-theme="dark"] .form-control:focus {
    background: #111e38;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
    color: #ffffff;
}

html[data-theme="dark"] .form-label {
    color: #cbd5e1;
}

html[data-theme="dark"] .table {
    color: #e2e8f0;
}

html[data-theme="dark"] .table th {
    background: #0f1c34;
    color: #cbd5e1;
    border-bottom: 2px solid var(--border-color);
}

html[data-theme="dark"] .table td {
    border-bottom: 1px solid var(--border-color);
}

html[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .mobile-drawer {
    background: #0f1c34;
    border-left: 1px solid var(--border-color);
}

html[data-theme="dark"] .drawer-header {
    border-bottom: 1px solid var(--border-color);
}

html[data-theme="dark"] .mobile-nav-link {
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #38bdf8;
}

html[data-theme="dark"] .patient-subnav {
    background: #0f1c34;
    border-bottom: 1px solid var(--border-color);
}

html[data-theme="dark"] .patient-subnav a {
    color: #94a3b8;
}

html[data-theme="dark"] .patient-subnav a.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
}

html[data-theme="dark"] .booking-progress-step {
    background: #152445;
    border-color: var(--border-color);
    color: #94a3b8;
}

html[data-theme="dark"] .booking-progress-step.active {
    background: #0284c7;
    color: #ffffff;
}

html[data-theme="dark"] .slot-btn {
    background: #101c36;
    border-color: #233860;
    color: #e2e8f0;
}

html[data-theme="dark"] .slot-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

html[data-theme="dark"] .pwa-install-banner {
    background: #0d1830;
    border-color: #233860;
    color: #f8fafc;
}

html[data-theme="dark"] .site-footer {
    background: #060b18;
    border-top: 1px solid #1e3256;
}

/* ==========================================================================
   زر التبديل بين الوضع الليلي والنهاري (Theme Toggle Button)
   ========================================================================== */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: rgba(8, 76, 97, 0.08);
    border: 1px solid rgba(8, 76, 97, 0.15);
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: rotate(15deg) scale(1.05);
    box-shadow: 0 4px 12px rgba(8, 76, 97, 0.25);
}

html[data-theme="dark"] .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f59e0b;
}

html[data-theme="dark"] .theme-toggle-btn:hover {
    background: #f59e0b;
    color: #0b1329;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

/* ==========================================================================
   شريط التنقل السفلي للهواتف الذكية (Mobile App Bottom Navigation Bar)
   ========================================================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
    z-index: 990;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] .mobile-bottom-nav {
    background: rgba(15, 28, 52, 0.95);
    border-top: 1px solid rgba(30, 50, 86, 0.9);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    flex: 1;
    max-width: 75px;
    text-align: center;
}

.bottom-nav-item i {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--primary-color);
}

html[data-theme="dark"] .bottom-nav-item:hover,
html[data-theme="dark"] .bottom-nav-item.active {
    color: #38bdf8;
}

.bottom-nav-item.active i {
    transform: translateY(-2px) scale(1.1);
}

/* زر الحجز البارز في منتصف شريط الهواتف */
.bottom-nav-item.nav-book-highlight {
    color: #ffffff !important;
    position: relative;
    top: -12px;
    flex: 0 0 auto;
}

.bottom-nav-item.nav-book-highlight .highlight-circle {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #059669, #10b981);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    border: 3px solid #ffffff;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

html[data-theme="dark"] .bottom-nav-item.nav-book-highlight .highlight-circle {
    border-color: #111e38;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.bottom-nav-item.nav-book-highlight:hover .highlight-circle,
.bottom-nav-item.nav-book-highlight:active .highlight-circle {
    transform: scale(1.12);
}

.bottom-nav-item.nav-book-highlight span {
    color: #059669;
    font-weight: 700;
    margin-top: 2px;
}

html[data-theme="dark"] .bottom-nav-item.nav-book-highlight span {
    color: #34d399;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }
    body:not(.kiosk-mode):not(.queue-mode) {
        padding-bottom: 74px !important;
    }
    .top-bar {
        display: none !important;
    }
    .site-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    .navbar {
        padding: 0.5rem 0;
        gap: 0.5rem;
        flex-wrap: nowrap;
        justify-content: space-between;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .brand-logo {
        gap: 0.5rem;
        max-width: 68%;
        min-width: 0;
        flex-shrink: 1;
    }
    .brand-logo img {
        height: 38px !important;
        max-width: 44px !important;
        object-fit: contain;
        flex-shrink: 0;
    }
    .brand-text {
        min-width: 0;
        overflow: hidden;
    }
    .brand-text h2 {
        font-size: 0.98rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .brand-text span {
        display: none !important;
    }
    .nav-actions {
        gap: 0.4rem;
        flex-shrink: 0;
    }
    .nav-actions .btn-sm {
        display: none !important;
    }
    .hero-section {
        padding: 2.25rem 0 3rem;
    }
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.35;
    }
    .hero-subtitle {
        font-size: 0.95rem;
    }
    .pwa-floating-btn {
        bottom: 82px !important;
        right: 16px !important;
        padding: 0.55rem 1rem !important;
        font-size: 0.82rem !important;
    }
    .pwa-install-banner.visible {
        bottom: 74px !important;
        left: 10px !important;
        right: 10px !important;
        padding: 0.75rem 1rem !important;
    }
    .scroll-to-top {
        bottom: 82px !important;
        right: 16px !important;
    }
    .fab-speed-dial {
        bottom: 82px !important;
        left: 16px !important;
    }
}

/* ==========================================================================
   زر الإجراءات السريع العائم والمساعدة (Floating Speed-Dial FAB)
   ========================================================================== */
.fab-speed-dial {
    position: fixed;
    bottom: 85px;
    left: 20px;
    z-index: 980;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
}

@media (min-width: 769px) {
    .fab-speed-dial {
        bottom: 28px;
        left: 28px;
    }
}

.fab-main-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #084c61, #0d9488);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 24px rgba(8, 76, 97, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.fab-main-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #0d9488;
    opacity: 0;
    animation: fab-pulse 2.5s infinite;
}

@keyframes fab-pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    70% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

.fab-speed-dial.open .fab-main-btn {
    transform: rotate(45deg);
    background: #ef4444;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.fab-speed-dial.open .fab-main-btn::after {
    animation: none;
}

.fab-options {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    opacity: 0;
    transform: translateY(15px) scale(0.85);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-speed-dial.open .fab-options {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 30px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(226, 232, 240, 0.8);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

html[data-theme="dark"] .fab-item {
    background: #111e38;
    border-color: #1e3256;
    color: #f8fafc;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.fab-item:hover {
    transform: translateX(-4px) scale(1.03);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.fab-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.fab-item.whatsapp .fab-item-icon { background: #25D366; }
.fab-item.phone .fab-item-icon { background: #0284c7; }
.fab-item.booking .fab-item-icon { background: #10b981; }

/* ==========================================================================
   زر الصعود للأعلى (Back to Top Button)
   ========================================================================== */
.scroll-to-top {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.85);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 970;
}

@media (min-width: 769px) {
    .scroll-to-top {
        bottom: 28px;
        right: 28px;
    }
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.scroll-to-top:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 8px 20px rgba(8, 76, 97, 0.25);
}

html[data-theme="dark"] .scroll-to-top {
    background: #111e38;
    border-color: #1e3256;
    color: #38bdf8;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .scroll-to-top:hover {
    background: #0284c7;
    color: #ffffff;
}

/* طباعة مستندات نظيفة */
@media print {
    .mobile-bottom-nav,
    .fab-speed-dial,
    .scroll-to-top,
    .theme-toggle-btn {
        display: none !important;
    }
}

/* ==========================================================================
   Responsive Table-to-Card Transformation for Mobile (عرض السجلات كبطاقات كروت)
   ========================================================================== */
@media (max-width: 991px) {
    .table-responsive {
        overflow-x: visible !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) {
        display: block !important;
        width: 100% !important;
        border: none !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) thead {
        display: none !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) tbody tr {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        background: #ffffff !important;
        border: 1px solid var(--border-color, #e2e8f0) !important;
        border-radius: 14px !important;
        padding: 1rem 1.15rem !important;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05) !important;
        box-sizing: border-box !important;
        margin-bottom: 0 !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
        position: relative !important;
    }

    html[data-theme="dark"] .table:not(.no-cards):not(.table-compact):not(.med-table) tbody tr {
        background: #111e27 !important;
        border-color: rgba(255, 255, 255, 0.09) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) td {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0.55rem 0 !important;
        border-bottom: 1px dashed rgba(226, 232, 240, 0.8) !important;
        border-top: none !important;
        text-align: left !important;
        font-size: 0.88rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    html[data-theme="dark"] .table:not(.no-cards):not(.table-compact):not(.med-table) td {
        border-bottom-color: rgba(255, 255, 255, 0.07) !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) td::before {
        content: attr(data-label);
        font-weight: 700 !important;
        color: var(--text-muted, #64748b) !important;
        font-size: 0.82rem !important;
        flex-shrink: 0 !important;
        margin-left: 0.75rem !important;
        text-align: right !important;
    }

    html[data-theme="dark"] .table:not(.no-cards):not(.table-compact):not(.med-table) td::before {
        color: #94a3b8 !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) td:last-child {
        border-bottom: none !important;
        padding-top: 0.75rem !important;
        margin-top: 0.25rem !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        gap: 0.45rem !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) td:last-child::before {
        content: attr(data-label);
        width: 100% !important;
        margin-bottom: 0.35rem !important;
        margin-left: 0 !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) td:not([data-label])::before {
        display: none !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) td[colspan] {
        display: block !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 2rem 1rem !important;
        color: var(--text-muted) !important;
    }

    .table:not(.no-cards):not(.table-compact):not(.med-table) td[colspan]::before {
        display: none !important;
    }
}
