/* =========================================
   17. NEW PATIENT PROFILE (MODERN GRID)
   ========================================= */
.profile-grid-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    /* Left (Content), Right (Profile Card) */
    gap: 25px;
    align-items: start;
}

@media (max-width: 991px) {
    .profile-grid-container {
        grid-template-columns: 1fr;
        /* Stack on mobile */
    }

    .profile-card-modern {
        order: -1;
        /* Show profile on top on mobile */
        position: relative !important;
        top: 0 !important;
    }
}

/* Right Side: Profile Card */
.profile-card-modern {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 20px;
    /* Sticky scroll */
    border: 1px solid #f0f0f0;
}

/* حبوب التبويب: أيقونة + نص في سطر واحد */
.p-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.pill-text-short {
    display: none;
}

/* Desktop: ensure "Medical Info" tab stays icon + text in one line */
@media (min-width: 1025px) {
    body:not(.is-apk-tablet):not(.is-apk-mobile) #ptab-btn-medical {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    body:not(.is-apk-tablet):not(.is-apk-mobile) #ptab-btn-medical .pill-text-full {
        display: inline !important;
    }
    body:not(.is-apk-tablet):not(.is-apk-mobile) #ptab-btn-medical .pill-text-short {
        display: none !important;
    }
}

.p-card-avatar {
    width: 120px;
    height: 120px;
    background: #f1f5f9;
    /* Light gray background for placeholder */
    border-radius: 24px;
    /* Premium Rounded Corner */
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    /* Modern soft shadow */
}

.p-card-avatar i {
    font-size: 60px;
    color: #94a3b8;
    /* Subtle icon color */
}

.p-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    /* Hidden by default if use icon */
}

.p-card-avatar.has-image i {
    display: none;
}

.p-card-avatar.has-image img {
    display: block;
}


.p-card-name {
    font-size: 22px;
    font-weight: 800;
    color: #333;
    margin-bottom: 5px;
    font-family: 'Cairo', sans-serif;
}

.p-card-id {
    display: inline-block;
    background: #f8f9fa;
    color: #666;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 25px;
    border: 1px solid #eee;
}

/* Info Grid in Card */
.p-info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.p-info-row:last-child {
    border-bottom: none;
}

.p-info-label {
    color: #212121;
    font-weight: 600;
}

.p-info-val {
    font-weight: 700;
    color: #444;
}

.p-info-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.p-info-icon-wrapper i {
    width: 24px;
    text-align: center;
    color: #3b82f6;
}

/* أيقونة الصف قبل العنوان (الهاتف، العمر، الجنس) */
.p-info-row-icon {
    width: 24px;
    text-align: center;
    color: #3b82f6;
    flex-shrink: 0;
}

/* Red Flags Box */
.p-red-flags {
    background: #fef2f2;
    border-radius: 12px;
    padding: 18px;
    margin-top: 25px;
    text-align: right;
    border: 1px dashed #f87171;
    position: relative;
    overflow: hidden;
}

.p-red-flags::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #ef4444;
}

/* Stats Infographic Box (Turquoise Green) */
.p-stats-box {
    background: #f0fdfa;
    border-radius: 12px;
    padding: 18px;
    margin-top: 25px;
    text-align: right;
    border: 1px dashed #2dd4bf;
    position: relative;
    overflow: hidden;
}

.p-stats-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #0d9488;
}

.stats-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(13, 148, 136, 0.1);
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    background: #fff;
    border-color: #2dd4bf;
}

.stat-val {
    font-size: 15px;
    font-weight: 800;
    color: #0f766e;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 10px;
    color: #557c7c;
    font-weight: 600;
}

body.dark-mode .p-stats-box {
    background: rgba(13, 58, 54, 0.3);
    border-color: #0d9488;
}

body.dark-mode .stat-item {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .stat-val {
    color: #2dd4bf;
}

body.dark-mode .stat-label {
    color: #94a3b8;
}

/* Left Side: Tabs & Content */
.profile-action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.profile-pills {
    display: flex;
    gap: 5px;
    background: linear-gradient(219deg, #f8f9fa 0%, #e2e8f0 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 8px;
    border-radius: 12px;
    position: relative;
    z-index: 1;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    margin-bottom: 8px !important;
}

.profile-pills::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Webkit */
}

.p-pill {
    padding: 12px 10px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex: 1 0 auto;
    text-align: center;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    min-width: 80px;
    white-space: nowrap;
}

.p-pill i {
    font-size: 24px;
    transition: all 0.3s ease;
}

.p-pill#ptab-btn-personal i {
    color: #3b82f6;
}

/* Blue */
.p-pill#ptab-btn-medical i {
    color: #10b981;
}

/* Emerald */
.p-pill#ptab-btn-rx i {
    color: #8b5cf6;
}

/* Violet */
.p-pill#ptab-btn-reports i {
    color: #f59e0b;
}

/* Amber */
.p-pill#ptab-btn-referrals i {
    color: #ec4899;
}

/* Pink */
.p-pill#ptab-btn-visits i {
    color: #06b6d4;
}

/* Cyan */
.p-pill#ptab-btn-attachments i {
    color: #64748b;
}

/* Slate */

.p-pill:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.p-pill:hover i {
    transform: scale(1.1);
}

.p-pill.active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    font-weight: 800;
}

.profile-tab-content {
    background: linear-gradient(to bottom right, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 30px;
    min-height: 500px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
    position: relative;
}

/* Dark Mode Adjustments */
body.dark-mode .profile-card-modern,
body.dark-mode .profile-tab-content,
body.dark-mode .profile-pills {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {

    body.dark-mode .profile-card-modern,
    body.dark-mode .profile-tab-content {
        background: #0f172a;
        border-color: #334155;
    }
}

body.dark-mode .p-card-avatar {
    background: linear-gradient(135deg, #1e3a8a, #1f2937);
    color: #60a5fa;
    border-color: #334155;
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.2);
}

body.dark-mode .p-card-name {
    color: #f8fafc;
}

body.dark-mode .p-info-label {
    color: #94a3b8;
}

body.dark-mode .p-info-val {
    color: #e2e8f0;
}

body.dark-mode .p-info-row {
    border-color: #334155;
}

body.dark-mode .p-card-id {
    background: #1e3a8a;
    border-color: #60a5fa;
    color: #f8fafc;
}

body.dark-mode .p-red-flags {
    background: rgba(69, 10, 10, 0.5);
    border-color: #ef4444;
}

body.dark-mode .profile-pills {
    background: #0f172a;
}

body.dark-mode .p-pill {
    color: #94a3b8;
}

body.dark-mode .p-pill:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

body.dark-mode .p-pill.active {
    background: #1e3a8a;
    color: #38bdf8;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.dark-mode .p-info-icon-wrapper i {
    color: #60a5fa;
}
body.dark-mode .p-info-row-icon {
    color: #60a5fa;
}

/* معلومات طبية: عرض أوضح مع بقاء الأيقونة والنص في سطر واحد */
#prof-content-medical {
    width: 100%;
    max-width: 100%;
}
#prof-content-medical .p-info-label {
    white-space: nowrap;
}

/* حقل الجنس وغيره في البطاقة الجانبية: نفس أسلوب التعبئة (دارك مود) */
body.dark-mode .profile-card-modern .p-info-icon-wrapper {
    background: #1e293b;
    border-radius: 8px;
    padding: 4px 10px;
    border: 1px solid #334155;
}
/* حقل الجنس (select) في معلومات شخصية مثل أقرانه */
body.dark-mode #info-gender,
body.dark-mode select.prof-edit-input {
    background: #edf3ff !important;
    color: #0f172a !important;
}

/* =========================================
   18. ANIMATED DASHBOARD (PATIENTS)
   ========================================= */
.p-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    max-width: 1200px;
    margin: 40px auto;
}

@media (max-width: 1100px) {
    .p-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .p-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.m-dash-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    border: 1px solid #f1f5f9;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.m-dash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #3b82f6, #0d6efd);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.m-dash-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(13, 110, 253, 0.15);
}

.m-dash-card:hover::before {
    transform: scaleX(1);
}

.m-d-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    font-size: 32px;
    transition: all 0.4s ease;
}

.m-dash-card:hover .m-d-icon-circle {
    transform: scale(1.1) rotate(5deg);
    background: #eff6ff;
}

.m-d-title {
    font-weight: 800;
    font-size: 20px;
    margin-bottom: 10px;
    color: #1e293b;
    font-family: 'Cairo', sans-serif;
}

.m-d-desc {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

/* Specific Colors */
.m-card-add .m-d-icon-circle {
    color: #10b981;
    background: #ecfdf5;
}

.m-card-add:hover .m-d-icon-circle {
    background: #d1fae5;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.m-card-search .m-d-icon-circle {
    color: #3b82f6;
    background: #eff6ff;
}

.m-card-search:hover .m-d-icon-circle {
    background: #dbeafe;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.m-card-edit .m-d-icon-circle {
    color: #f59e0b;
    background: #fffbeb;
}

.m-card-edit:hover .m-d-icon-circle {
    background: #fef3c7;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.m-card-list .m-d-icon-circle {
    color: #6366f1;
    background: #eef2ff;
}

.m-card-list:hover .m-d-icon-circle {
    background: #e0e7ff;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* Dark Mode */
body.dark-mode .m-dash-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body.dark-mode .m-d-title {
    color: #f8fafc;
}

body.dark-mode .m-d-desc {
    color: #94a3b8;
}

body.dark-mode .m-d-icon-circle {
    background: #0f172a;
}

/* Specific Dark Icons */
body.dark-mode .m-card-add .m-d-icon-circle {
    color: #34d399;
    background: #064e3b;
}

body.dark-mode .m-card-search .m-d-icon-circle {
    color: #60a5fa;
    background: #1e3a8a;
}

body.dark-mode .m-card-edit .m-d-icon-circle {
    color: #fbbf24;
    background: #78350f;
}

body.dark-mode .m-card-list .m-d-icon-circle {
    color: #818cf8;
    background: #312e81;
}

/* Entrance Animation */
@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.m-dash-card:nth-child(1) {
    animation: cardEntrance 0.5s ease 0s backwards;
}

.m-dash-card:nth-child(2) {
    animation: cardEntrance 0.5s ease 0.1s backwards;
}

.m-dash-card:nth-child(3) {
    animation: cardEntrance 0.5s ease 0.2s backwards;
}

.m-dash-card:nth-child(4) {
    animation: cardEntrance 0.5s ease 0.3s backwards;
}

/* =========================================
   19. MODERN MODALS (GLASSMORPHISM)
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal-box {
    background: #fff;
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.close-modal {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    transition: 0.3s;
    line-height: 1;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

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

/* Dark Mode Modal */
body.dark-mode .modal-box {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-mode .modal-box .form-label {
    color: #94a3b8;
}

body.dark-mode .modal-box .form-control {
    background: #0f172a;
    border-color: #334155;
    color: #fff;
}

body.dark-mode .modal-box h3 {
    color: #38bdf8 !important;
}

/* Profile Inline Editing */
.prof-edit-input {
    transition: all 0.2s ease-in-out;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 15px;
    font-size: 15px;
    height: auto !important;
}

.prof-edit-input:disabled {
    background: #f8f9fa !important;
    border-color: #ced4da !important;
    /* Visible Grey Border */
    color: #000000 !important;
    cursor: default;
    opacity: 1;
    -webkit-text-fill-color: #000000;
    /* For iOS */
}

.prof-edit-input:not(:disabled) {
    background: #ffffff !important;
    border: 2px solid #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
    color: #0f172a !important;
}

body.dark-mode .prof-edit-input:disabled {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

body.dark-mode .prof-edit-input:not(:disabled) {
    background: #0f172a !important;
    border-color: #60a5fa !important;
    color: #f8fafc !important;
}

/* =========================================
   20. MODERN PATIENT FORM
   ========================================= */
.modern-patient-form {
    background: #fff;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
    width: 100%;
    margin: 0 auto;
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
}

.modern-patient-form::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(13, 110, 253, 0.05));
    border-radius: 50%;
    z-index: 0;
}

.form-header-modern {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 35px;
    position: relative;
    z-index: 1;
}

.form-header-modern .icon-box {
    width: 45px;
    height: 45px;
    background: rgba(59, 130, 246, 0.08);
    /* Simpler, lighter background */
    color: #3b82f6;
    border-radius: 8px;
    /* Square with small radius instead of circle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.form-header-modern h4 {
    margin: 0;
    font-weight: 800;
    color: #1e293b;
    font-size: 22px;
}

.input-group-modern {
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.input-group-modern label {
    display: block;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
    font-size: 14px;
}

.input-wrapper-inner {
    position: relative;
}

.input-wrapper-inner i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    transition: 0.3s;
}

.input-modern {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.input-modern:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
}

.input-modern:focus+i {
    color: #3b82f6;
}

.btn-premium-save {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff;
    border: none;
    padding: 14px 40px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 17px;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 10px 25px rgba(31, 58, 168, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
}

.btn-premium-save:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(31, 58, 168, 0.3);
    color: #fff;
}

.btn-back-modern {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 8px 18px;
    border-radius: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    margin-bottom: 30px;
}

.btn-back-modern:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Dark Mode Form */
body.dark-mode .modern-patient-form {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .form-header-modern h4 {
    color: #f8fafc;
}

body.dark-mode .form-header-modern .icon-box {
    background: #0f172a;
    color: #60a5fa;
}

body.dark-mode .input-modern {
    background: #0f172a;
    border-color: #334155;
    color: #fff;
}

body.dark-mode .input-group-modern label {
    color: #94a3b8;
}

body.dark-mode .btn-back-modern {
    background: #334155;
    color: #cbd5e1;
}

body.dark-mode .btn-back-modern:hover {
    background: #475569;
}

/* Search View Enhancements */
.search-results-modern {
    margin-top: 30px;
    text-align: right;
    border-top: 1px solid #f1f5f9;
    padding-top: 20px;
}

.search-results-modern h5 {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 15px;
    font-weight: 700;
}

.result-item-modern {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.3s;
    cursor: pointer;
}

.result-item-modern:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateX(-5px);
}

.result-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-icon {
    width: 35px;
    height: 35px;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.result-text .name {
    display: block;
    font-weight: 700;
    color: #1e293b;
    font-size: 14px;
}

.result-text .phone {
    font-size: 12px;
    color: #94a3b8;
}

body.dark-mode .result-item-modern {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .result-text .name {
    color: #f8fafc;
}

body.dark-mode .result-icon {
    background: #1e293b;
    color: #94a3b8;
}

body.dark-mode .search-results-modern {
    border-color: #334155;
}

/* =========================================
   22. CREATIVE PATIENT DIRECTORY
   ========================================= */
.patient-directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.patient-dir-card {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.patient-dir-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: #3b82f6;
}

.pd-avatar {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 15px;
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.15);
}

.pd-info h3 {
    font-size: 17px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.pd-info p {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 15px;
}

/* Patient Directory Card Buttons - Premium Style from Screenshot */
.pd-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: auto;
}

/* Mobile Styling for Patient Directory - Match Table Card Style */
@media (max-width: 991px) {
    .patient-directory-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 5px !important;
    }

    .patient-dir-card {
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 15px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
        overflow: hidden;
        border-right: 5px solid #1e3a8a !important;
        position: relative;
        padding: 15px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: right !important;
    }

    .pd-avatar {
        position: absolute !important;
        left: 15px !important;
        top: 15px !important;
        width: 45px !important;
        height: 45px !important;
        margin: 0 !important;
        z-index: 10;
    }

    .pd-info {
        width: 100% !important;
        padding-left: 55px !important;
        /* Space for avatar on left */
        margin-bottom: 10px !important;
    }

    .pd-info h3 {
        font-size: 16px !important;
        margin-bottom: 5px !important;
        color: #1e3a8a !important;
        text-align: right !important;
    }

    .pd-info p {
        font-size: 13px !important;
        margin: 0 !important;
        text-align: right !important;
        color: #64748b !important;
    }

    /* Key-Value styling for extras if needed, but currently pd-info covers it */
    .pd-actions {
        border-top: 1px dashed #e2e8f0 !important;
        padding-top: 12px !important;
        justify-content: center !important;
    }

    .pd-btn {
        padding: 8px 15px !important;
        font-size: 13px !important;
    }

    body.dark-mode .patient-dir-card {
        background: #1e1e2e !important;
        border-color: #444 !important;
    }
}

.pd-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 8px;
    /* Slightly rounded corners */
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Subtle shadow */
}

/* Edit Button - Solid Orange/Gold */
.pd-btn-edit {
    background-color: #e0a800;
    /* Matching screenshot orange */
    color: #fff !important;
    border: 1px solid #c69500;
}

.pd-btn-edit:hover {
    background-color: #d39e00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(224, 168, 0, 0.3);
}

.pd-btn-edit i {
    font-size: 16px;
}

/* View Button - Light Gray/Blue */
.pd-btn-view {
    background-color: #f1f5f9;
    color: #475569 !important;
    border: 1px solid #cbd5e1;
}

.pd-btn-view:hover {
    background-color: #e2e8f0;
    color: #1e293b !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Dark Mode Overrides for Buttons */
body.dark-mode .pd-btn-edit {
    background-color: #ffc107;
    color: #000 !important;
    border-color: #ffc107;
}

body.dark-mode .pd-btn-edit:hover {
    background-color: #ffdb4d;
}

body.dark-mode .pd-btn-view {
    background-color: #334155;
    color: #e2e8f0 !important;
    border-color: #475569;
}

body.dark-mode .pd-btn-view:hover {
    background-color: #475569;
    color: #fff !important;
}

/* Ensure Text Buttons in Table match color scheme too */
.ct-btn-text.edit {
    color: #fff;
    background-color: #e0a800;
    padding: 6px 14px;
}

.ct-btn-text.edit:hover {
    background-color: #d39e00;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

body.dark-mode .ct-btn-text.edit {
    background-color: #ffc107;
    color: #000;
}

/* =========================================
   23. CREATIVE TABLE DIRECTORY (SEARCH VIEW)
   ========================================= */
.creative-table-wrapper {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    margin-top: 20px;
}

.ct-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 100px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 800;
    color: #475569;
    font-size: 13px;
    padding: 15px 20px;
}

.ct-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 100px;
    padding: 12px 20px;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    transition: 0.2s;
    cursor: pointer;
}

.ct-row:last-child {
    border-bottom: none;
}

.ct-row:hover {
    background: #f0f9ff;
}

.ct-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ct-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0284c7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.ct-text {
    display: flex;
    flex-direction: column;
}

.ct-name {
    font-weight: 800;
    color: #1e293b;
    font-size: 15px;
}

.ct-id {
    font-size: 12px;
    color: #94a3b8;
}

.ct-phone {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* For better numbers */
    color: #334155;
    font-weight: 600;
    font-size: 14px;
}

.ct-meta {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ct-divider {
    color: #cbd5e1;
}

.ct-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Text Buttons for Creative Table */
.ct-btn-text {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.ct-btn-text:hover {
    background: #e2e8f0;
    color: #3b82f6;
}

.ct-btn-text.edit {
    color: #d97706;
    background: rgba(245, 158, 11, 0.1);
}

.ct-btn-text.edit:hover {
    background: #f59e0b;
    color: #fff;
}

/* Dark Mode Adjustments */
body.dark-mode .ct-btn-text {
    color: #94a3b8;
}

body.dark-mode .ct-btn-text:hover {
    background: #334155;
    color: #60a5fa;
}

body.dark-mode .ct-btn-text.edit {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

body.dark-mode .ct-btn-text.edit:hover {
    background: #f59e0b;
    color: #000;
}

/* Mobile Table Styles */
@media (max-width: 600px) {
    .ct-header {
        display: none;
    }

    .ct-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 15px;
        border-bottom: 4px solid #f8f9fa;
    }

    .ct-info {
        margin-bottom: 5px;
    }

    .ct-actions {
        justify-content: flex-start;
        margin-top: 5px;
    }
}

/* Dark Mode Table */
body.dark-mode .creative-table-wrapper {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .ct-header {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .ct-row {
    border-color: #334155;
}

body.dark-mode .ct-row:hover {
    background: #334155;
}

body.dark-mode .ct-name {
    color: #f8fafc;
}

body.dark-mode .ct-phone {
    color: #cbd5e1;
}

body.dark-mode .ct-avatar {
    background: #0f172a;
    color: #38bdf8;
}

body.dark-mode .ct-btn {
    background: #334155;
    color: #94a3b8;
}

body.dark-mode .ct-btn:hover {
    color: #fff;
}

/* Personal Photo Edit Frame */
.personal-photo-frame {
    width: 140px;
    height: 140px;
    background: #f8fafc;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 3px dashed #cbd5e1;
    margin: 0 auto;
    transition: 0.3s;
    overflow: visible;
}

.personal-photo-frame img {
    width: 125px;
    height: 125px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.personal-photo-frame .edit-overlay {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #3b82f6;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    transition: 0.2s;
    z-index: 5;
}

.personal-photo-frame .edit-overlay:hover {
    transform: scale(1.1);
    background: #2563eb;
}

body.dark-mode .personal-photo-frame {
    background: #1e293b;
    border-color: #475569;
}

/* =========================================
   MODERN FOOTER ACTION BAR & BUTTONS
   ========================================= */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    flex-wrap: wrap;
    border-top: 1px solid #f1f5f9;
}

/* Base Modern Button */
.btn-modern {
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.btn-modern:hover {
    transform: translateY(-3px);
}

.btn-modern i {
    font-size: 18px;
}

/* Print Button (Vibrant Blue Gradient) */
/* Print Button (Vibrant Blue Gradient) */
.btn-modern-print {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4) !important;
}

.btn-modern-print:hover {
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5) !important;
    color: white !important;
}

/* Save Button */
.btn-modern-save {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
}

.btn-modern-save:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5) !important;
    color: white !important;
}

/* Save & Print */
.btn-modern-save-print {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important;
}

.btn-modern-save-print:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5) !important;
    color: white !important;
}

/* زر التعديل في الأكشن بار (ملف المريض) */
.btn-modern-edit-profile {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4) !important;
}

.btn-modern-edit-profile:hover {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5) !important;
    color: white !important;
}

/* زر إلغاء التعديل في الأكشن بار */
.btn-modern-cancel-edit {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(100, 116, 139, 0.4) !important;
}

.btn-modern-cancel-edit:hover {
    box-shadow: 0 8px 25px rgba(100, 116, 139, 0.5) !important;
    color: white !important;
}

/* Secondary Button (Settings/Theme) */
.btn-modern-secondary {
    background: #fff;
    color: #64748b;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 15px;
    width: 45px;
    height: 45px;
    justify-content: center;
}

.btn-modern-secondary:hover {
    background: #f8fafc;
    color: #334155;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Disabled State */
.btn-modern:disabled,
.btn-modern.disabled {
    opacity: 0.6 !important;
    filter: grayscale(0.8) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none;
}

/* Dark Mode Support */
body.dark-mode .action-bar {
    background: rgba(30, 41, 59, 0.9);
    border-top-color: #334155;
}

/* الدارك مود + موبايل فقط: ستايل الأكشن بار والأزرار (حفظ، طباعة، حفظ وطباعة) */
@media (max-width: 768px) {
    body.dark-mode .action-bar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        padding: 10px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 20px)) !important;
        border-top: 1px solid #334155 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        z-index: 9999 !important;
        gap: 5px !important;
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        justify-content: center;
        align-items: center;
        background: rgba(30, 41, 59, 0.9) !important;
        backdrop-filter: blur(10px);
    }
    body.dark-mode .action-bar .btn-modern-save {
        color: white !important;
        box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4) !important;
        height: 52px !important;
        border-radius: 12px !important;
        font-weight: bold !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #10b981 0%, #066749 100%) !important;
        flex: 1 1 calc(33.33% - 10px) !important;
        padding: 0 5px !important;
        font-size: 11px !important;
    }
    body.dark-mode .action-bar .btn-modern-print {
        color: white !important;
        box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4) !important;
        height: 52px !important;
        border-radius: 12px !important;
        font-weight: bold !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #3b82f6 0%, #193571 100%) !important;
        flex: 1 1 calc(33.33% - 10px) !important;
        padding: 0 5px !important;
        font-size: 11px !important;
    }
    body.dark-mode .action-bar .btn-modern-save-print {
        color: white !important;
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important;
        height: 52px !important;
        border-radius: 12px !important;
        font-weight: bold !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #6366f1 0%, #3f37c3 100%) !important;
        flex: 1 1 calc(33.33% - 10px) !important;
        padding: 0 5px !important;
        font-size: 11px !important;
    }
    /* الدارك مود: إظهار الأزرار المفعّلة فقط — إخفاء المعطّلة على الموبايل */
    body.dark-mode .action-bar button:disabled,
    body.dark-mode .action-bar button[disabled] {
        display: none !important;
    }
    /* إخفاء أزرار ملف المريض (حفظ/إلغاء) خارج صفحة الملف — تجاوز display:flex في الدارك مود */
    body.dark-mode .action-bar button.btn-profile-action.action-bar-profile-hidden {
        display: none !important;
    }
}

body.dark-mode .btn-modern-secondary {
    background: #1e293b;
    color: #94a3b8;
    border-color: #475569;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

body.dark-mode .btn-modern-secondary:hover {
    background: #334155;
    color: #fff;
}

body.dark-mode .btn-modern:disabled {
    opacity: 0.5 !important;
    filter: grayscale(0.8) !important;
    border-color: #475569 !important;
}

/* =========================================
   25. REVOLUTIONARY MOBILE PATIENT PROFILE
   ========================================= */
@media (max-width: 768px) {

    /* 1. Main Container Fixes */
    .modern-patient-form,
    #patients-view-profile .modern-patient-form {
        padding: 15px !important;
        border-radius: 16px !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05) !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    #patients-view-profile {
        padding-bottom: 20px !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* 2. Top Action Header (Back, New, Delete) */
    .profile-action-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 20px !important;
        gap: 5px !important;
        flex-wrap: nowrap !important;
    }

    .profile-action-header>button,
    .profile-action-header>div>button,
    .profile-action-header>div>div>button,
    .profile-action-header .btn-back-modern {
        font-size: 11px !important;
        padding: 8px 10px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        flex: 1 1 auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Dropdown CSS override removed */

    .profile-action-header .btn-danger {
        font-size: 12px !important;
        padding: 8px 12px !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* 3. The Rights Side (Profile Card inside the Grid) */
    .profile-grid-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        width: 100% !important;
    }

    .profile-card-modern {
        order: -1 !important;
        /* Forces it to the top */
        padding: 20px 15px !important;
        border-radius: 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-top: 0 !important;
        margin-bottom: 10px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04) !important;
    }

    /* Fix Avatar and Name overlap */
    .p-card-avatar {
        width: 90px !important;
        height: 90px !important;
        margin: 0 auto 15px !important;
        border-width: 3px !important;
    }

    .p-card-avatar i {
        font-size: 45px !important;
    }

    .p-card-name {
        font-size: 18px !important;
        line-height: 1.3 !important;
        word-break: break-word !important;
    }

    .p-card-id {
        font-size: 12px !important;
        margin-bottom: 15px !important;
    }

    /* Profile Info Rows inside Card */
    .p-info-row {
        padding: 10px 0 !important;
        align-items: center !important;
    }

    .p-info-label {
        font-size: 12px !important;
    }

    .p-info-val {
        font-size: 13px !important;
    }

    /* 4. The Content Area Header (Title + Action Buttons) */
    .profile-content-area {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .profile-content-area>div[style*="display:flex;"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
    }

    .profile-content-area h3 {
        font-size: 16px !important;
        text-align: center !important;
        line-height: 1.4 !important;
        width: 100% !important;
    }

    /* Grid for "Edit", "Save", "Cancel" buttons moved entirely to header, removing fixed CSS conflict */

    .profile-content-area button {
        width: 100% !important;
        padding: 12px 5px !important;
        font-size: 14px !important;
        border-radius: 12px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05) !important;
    }

    .profile-content-area button[style*="display: none"],
    .profile-content-area button[style*="display:none"] {
        display: none !important;
    }

    /* Removed overlapping new-action-dropdown rules - JS will handle it now */

    /* 5. Navigation Tabs (Pills) — موبايل: سطر1 و سطر3 بعرض كامل (شخصية+طبية ثم مراجعات+مرفقات)، سطر2 بدون تغيير */
    .profile-pills {
        display: grid !important;
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 8px !important;
        background: transparent !important;
        padding: 0 !important;
        margin-bottom: 15px !important;
    }
    .profile-pills .p-pill:nth-child(1) { grid-column: 1 / 4; }
    .profile-pills .p-pill:nth-child(2) { grid-column: 4 / 7; }
    .profile-pills .p-pill:nth-child(3) { grid-column: 1 / 3; }
    .profile-pills .p-pill:nth-child(4) { grid-column: 3 / 5; }
    .profile-pills .p-pill:nth-child(5) { grid-column: 5 / 7; }
    .profile-pills .p-pill:nth-child(6) { grid-column: 1 / 4; }
    .profile-pills .p-pill:nth-child(7) { grid-column: 4 / 7; }
    .profile-pills .pill-text-full { display: block !important; }
    .profile-pills .pill-text-short { display: none !important; }

    .p-pill {
        background: #f1f5f9 !important;
        border-radius: 10px !important;
        font-size: 12px !important;
        padding: 10px 5px !important;
        border: 1px solid #e2e8f0 !important;
        white-space: normal !important;
        line-height: 1.2 !important;
    }

    .p-pill.active {
        background: #1e3a8a !important;
        color: #fff !important;
        border-color: #1e3a8a !important;
    }

    body.dark-mode .p-pill {
        background: #090f1a !important;
    }

    /* 6. Forms and Grids Customization */
    .profile-tab-content {
        padding: 20px 15px !important;
        border-radius: 16px !important;
    }

    /* Any 4-column grids to 2-column */
    .prof-content>div[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    /* Sub Grids for Forms */
    .prof-content>div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .prof-edit-input,
    .p-info-label {
        font-size: 13px !important;
    }

    /* Stats Box Grid */
    .stats-info-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .stat-item {
        padding: 10px 5px !important;
    }

    .stat-val {
        font-size: 14px !important;
    }

    /* 7. Tables in Profile View (Mobile Only) */
    .profile-tab-content table {
        display: block !important;
        width: 100% !important;
    }

    .profile-tab-content thead {
        display: none !important;
    }

    .profile-tab-content tbody,
    .profile-tab-content tr,
    .profile-tab-content td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .profile-tab-content tr {
        margin-bottom: 15px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        padding: 10px !important;
        background: #fff !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02) !important;
    }

    .profile-tab-content td {
        display: flex !important;
        direction: rtl !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 8px 5px !important;
        border-bottom: 1px dashed #f1f5f9 !important;
        text-align: left !important;
    }

    .profile-tab-content td:last-child {
        border-bottom: none !important;
    }

    .profile-tab-content td::before {
        content: attr(data-label) !important;
        font-weight: 700 !important;
        color: #64748b !important;
        font-size: 12px !important;
        flex-shrink: 0 !important;
        text-align: right !important;
        min-width: 90px !important;
        margin-left: 10px !important;
    }

    /* 8. Specific Visits Table Card Layout */
    .mobile-visit-row {
        display: flex !important;
        flex-direction: column !important;
    }

    .mobile-visit-row td[data-label="رقم الحجز"] {
        order: -2 !important;
        background: #eff6ff !important;
        border-radius: 8px !important;
        padding: 10px !important;
        border-bottom: 1px solid #bfdbfe !important;
        margin-bottom: 5px !important;
    }

    .mobile-visit-row td[data-label="رقم الحجز"]::before {
        content: "رقم الحجز" !important;
        color: #1e3a8a !important;
        font-size: 14px !important;
    }

    .mobile-visit-row td[data-label="التاريخ"],
    .mobile-visit-row td[data-label="الوقت"] {
        order: -1 !important;
    }

    .mobile-visit-sequence {
        background: var(--primary, #1e3a8a) !important;
        color: #fff !important;
        width: 32px !important;
        height: 32px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        border: 2px solid #fff !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15) !important;
    }

}

@media (min-width: 769px) {
    .hide-on-desktop {
        display: none !important;
    }
}
