/* ====================================
   نظام إدارة العيادة - الأنماط الرئيسية
   ==================================== */

/* استيراد خط عربي */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* متغيرات CSS */
:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --primary-lighter: #99f6e4;
    --primary-bg: #f0fdfa;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --sidebar-bg: #134e4a;
    --sidebar-hover: #0d9488;
    --sidebar-text: #ccfbf1;
    --sidebar-active: #5eead4;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* إعادة تعيين عام */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.7;
}

/* شاشة التحميل */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease;
}

.loading-screen.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-screen h2 {
    color: white;
    margin-top: 20px;
    font-weight: 700;
}

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

/* ===== الشريط الجانبي ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand img {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: white;
    padding: 3px;
}

.sidebar-brand h5 {
    color: white;
    font-weight: 800;
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
}

.sidebar-brand small {
    color: var(--sidebar-text);
    font-size: 11px;
    opacity: 0.7;
}

.sidebar-menu {
    padding: 16px 12px;
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 2px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
    font-size: 14px;
    position: relative;
}

.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-menu a.active {
    background: var(--sidebar-hover);
    color: var(--sidebar-active);
    font-weight: 700;
}

.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--accent);
    border-radius: 4px 0 0 4px;
}

.sidebar-menu a i {
    width: 22px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-menu .menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 10px 16px;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-user-info h6 {
    color: white;
    font-size: 13px;
    font-weight: 700;
    margin: 0;
}

.sidebar-user-info small {
    color: var(--sidebar-text);
    font-size: 11px;
    opacity: 0.7;
}

/* ===== المحتوى الرئيسي ===== */
.main-content {
    margin-right: 280px;
    min-height: 100vh;
    transition: var(--transition);
}

/* ===== الشريط العلوي ===== */
.topbar {
    background: var(--bg-card);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 4px;
}

.topbar h4 {
    font-weight: 800;
    font-size: 20px;
    color: var(--text-dark);
    margin: 0;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.topbar-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
}

.topbar-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary-lighter);
}

.topbar-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.btn-logout {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

/* ===== محتوى الصفحة ===== */
.page-content {
    padding: 30px;
}

/* ===== البطاقات ===== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
}

.stat-card.card-primary::before { background: var(--primary); }
.stat-card.card-success::before { background: var(--success); }
.stat-card.card-warning::before { background: var(--warning); }
.stat-card.card-danger::before { background: var(--danger); }
.stat-card.card-info::before { background: var(--info); }
.stat-card.card-accent::before { background: var(--accent); }

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card.card-primary .stat-icon { background: var(--primary-bg); color: var(--primary); }
.stat-card.card-success .stat-icon { background: #ecfdf5; color: var(--success); }
.stat-card.card-warning .stat-icon { background: #fffbeb; color: var(--warning); }
.stat-card.card-danger .stat-icon { background: #fef2f2; color: var(--danger); }
.stat-card.card-info .stat-icon { background: #ecfeff; color: var(--info); }
.stat-card.card-accent .stat-icon { background: #fffbeb; color: var(--accent); }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* بطاقة عامة */
.content-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.content-card .card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.content-card .card-header h5 {
    font-weight: 800;
    font-size: 16px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-card .card-body {
    padding: 24px;
}

/* ===== الجداول ===== */
.table-container {
    overflow-x: auto;
}

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

.data-table thead th {
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 13px;
    padding: 14px 16px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 2px solid var(--primary-lighter);
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    vertical-align: middle;
}

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

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

/* ===== الأزرار ===== */
.btn {
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(13,148,136,0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}
.btn-warning:hover {
    background: var(--accent-dark);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}
.btn-info:hover {
    background: #0891b2;
    color: white;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ===== النماذج ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
/* ===== دعم الجوال ===== */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0 !important;
    }
    .topbar-actions {
        display: none;
    }
    .sidebar-toggle {
        display: flex !important;
    }
    .stat-card .stat-value {
        font-size: 22px;
    }
    .page-content {
        padding: 16px;
    }
    .topbar {
        padding: 12px 16px;
    }
    .topbar h4 {
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .stat-card {
        padding: 16px;
    }
    .content-card .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
