/* ============================================================
   تصميم احترافي (Premium Arabic RTL Theme) - عيادة الأسنان
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    /* Modern Colors */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
    --secondary: #6366f1;
    --success: #10b981;
    --success-light: #d1fae5;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --info: #06b6d4;
    
    /* Neutrals */
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-800: #1e293b;

    /* Backgrounds */
    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.9); /* Glass base */
    --bg-sidebar: #ffffff;
    
    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Glassmorphism Variables */
    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    
    /* Modern Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-premium: 0 10px 30px -10px rgba(0,0,0,0.08);
    --shadow-hover: 0 20px 40px -10px rgba(14, 165, 233, 0.15);

    /* Radius & Transitions */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-sidebar: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --shadow-premium: 0 10px 30px -10px rgba(0,0,0,0.5);
    --gray-100: #1e293b;
    --gray-200: #334155;
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Pattern/Gradient for premium feel */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; height: 300px;
    background: linear-gradient(180deg, var(--primary-light) 0%, transparent 100%);
    z-index: -1;
    opacity: 0.5;
}
[data-theme="dark"] body::before {
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.1) 0%, transparent 100%);
}

.app-wrapper { display: flex; min-height: 100vh; }

/* ============================================================ */
/* Sidebar (Modern RTL) */
/* ============================================================ */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.02);
    border-left: 1px solid var(--gray-100);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }

.sidebar-brand {
    padding: 24px 20px;
    display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-logo {
    width: 48px; height: 48px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.sidebar-brand-text {
    display: flex; flex-direction: column;
}

.sidebar-brand-text span {
    color: var(--text-primary);
    font-size: 1.25rem; font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-brand-text small {
    color: var(--text-secondary);
    font-size: 0.75rem; font-weight: 600;
}

.sidebar-nav { padding: 20px 0; flex: 1; }

.sidebar-nav .nav-section {
    padding: 24px 24px 8px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem; font-weight: 600;
    transition: var(--transition);
    margin: 4px 16px;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.sidebar-nav .nav-link i {
    width: 24px; text-align: center;
    font-size: 1.2rem;
    transition: var(--transition-bounce);
}

.sidebar-nav .nav-link:hover {
    background: var(--gray-50);
    color: var(--primary);
    transform: translateX(-4px); /* RTL hover move */
}

.sidebar-nav .nav-link:hover i {
    transform: scale(1.1);
}

.sidebar-nav .nav-link.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.sidebar-nav .nav-link.active i {
    color: white;
}

/* ============================================================ */
/* Main Content & Header */
/* ============================================================ */
.main-content {
    flex: 1; margin-right: 280px;
    min-height: 100vh; display: flex; flex-direction: column;
    transition: var(--transition);
}

.main-header {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: var(--glass-border);
    padding: 16px 32px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 999;
    box-shadow: var(--shadow-sm);
}

.content-wrapper { padding: 32px; flex: 1; }

.header-title { font-weight: 800; font-size: 1.25rem; color: var(--text-primary); margin: 0; }

.header-actions .btn-icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--gray-50); color: var(--text-secondary);
    border: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); margin-right: 12px;
}
.header-actions .btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary-light); }
.header-actions .dropdown-toggle { display: flex; align-items: center; gap: 10px; background: none; border: none; font-weight: 600; color: var(--text-primary); }
.header-actions .dropdown-toggle img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary-light); }

/* ============================================================ */
/* Glassmorphism Premium Cards */
/* ============================================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    transition: var(--transition);
    margin-bottom: 24px;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-100);
    padding: 20px 24px;
    font-weight: 700; font-size: 1.1rem;
    color: var(--text-primary);
    display: flex; align-items: center; justify-content: space-between;
}

.card-body { padding: 24px; }

/* Dashboard Stats Cards */
.stats-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-bounce);
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 8px;
}

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

.stats-card .icon-wrapper {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; margin-bottom: 8px;
}

.stats-card .stats-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stats-card .stats-label { color: var(--text-secondary); font-size: 0.9rem; font-weight: 600; }
.stats-card .stats-change { font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-full); display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; align-self: flex-start; }

/* Gradient Stat Backgrounds */
.bg-gradient-primary { background: var(--primary-gradient); color: white; }
.bg-gradient-success { background: var(--success-gradient); color: white; }
.bg-gradient-warning { background: var(--warning-gradient); color: white; }
.bg-gradient-danger { background: var(--danger-gradient); color: white; }

/* ============================================================ */
/* Tables (Modern) */
/* ============================================================ */
.table-responsive { border-radius: var(--radius-md); overflow: hidden; }
.table { margin-bottom: 0; color: var(--text-primary); vertical-align: middle; }
.table thead th { background: var(--gray-50); border-bottom: none; padding: 16px 20px; font-weight: 700; font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.table tbody td { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); font-weight: 500; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--primary-light); }

/* ============================================================ */
/* Buttons */
/* ============================================================ */
.btn {
    padding: 10px 24px; border-radius: var(--radius-md);
    font-weight: 700; transition: var(--transition-bounce);
    font-size: 0.95rem; border: none;
}
.btn-primary { background: var(--primary-gradient); color: white; box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4); background: var(--primary-gradient); color: white; }
.btn-success { background: var(--success-gradient); color: white; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4); color: white; }

/* ============================================================ */
/* Badges */
/* ============================================================ */
.badge { padding: 6px 12px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.5px; }
.bg-success { background: var(--success-light) !important; color: #065f46; }
.bg-warning { background: var(--warning-light) !important; color: #92400e; }
.bg-danger { background: var(--danger-light) !important; color: #991b1b; }
.bg-info { background: var(--info-light) !important; color: #155e75; }

/* ============================================================ */
/* Forms */
/* ============================================================ */
.form-control, .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 12px 16px; font-size: 0.95rem; font-weight: 500;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.8);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
    background: #ffffff;
}
.form-label { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 8px; }

/* ============================================================ */
/* Animations */
/* ============================================================ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.animate-fade-in-up { animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
.animate-scale-in { animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* ============================================================ */
/* Responsive */
/* ============================================================ */
@media (max-width: 991px) {
    .sidebar { right: -280px; }
    .sidebar.open { right: 0; }
    .main-content { margin-right: 0; }
    .content-wrapper { padding: 20px; }
}
