:root {
    --bg-color: #f5f7fb;
    --bg-secondary: #ffffff;
    --text-color: #1f2933;
    --text-muted: #6b7280;
    --primary-color: #2563eb;
    --primary-light: #dbeafe;
    --border-color: #e5e7eb;
    --card-radius: 16px;
    --sidebar-bg: #111827;
    --sidebar-text: #e5e7eb;
    --sidebar-active: #1f2937;
}

body.dark-mode {
    --bg-color: #020617;
    --bg-secondary: #020617;
    --text-color: #e5e7eb;
    --text-muted: #9ca3af;
    --primary-color: #3b82f6;
    --primary-light: #1d4ed8;
    --border-color: #1f2937;
    --sidebar-bg: #020617;
    --sidebar-text: #e5e7eb;
    --sidebar-active: #111827;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Reset بسيط */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "Tahoma", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Layout عام */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-sidebar .brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-sidebar .brand span {
    font-weight: 700;
    font-size: 1.1rem;
}

.app-sidebar .brand small {
    font-size: 0.75rem;
    color: #9ca3af;
}

.app-sidebar .nav {
    list-style: none;
    padding: 1rem 0.75rem;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.app-sidebar .nav li {
    margin-bottom: 0.35rem;
}

.app-sidebar .nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease, transform 0.1s ease;
}

.app-sidebar .nav a:hover {
    background-color: rgba(148, 163, 184, 0.3);
    transform: translateX(-2px);
}

.app-sidebar .nav a.active {
    background-color: var(--sidebar-active);
    font-weight: 600;
}

/* محتوى رئيسي */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-header {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header-left h1 {
    font-size: 1.1rem;
    margin: 0;
}

.app-header-left .subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* زر الثيم */
.theme-toggle-btn {
    border-radius: 999px;
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    background-color: transparent;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.theme-toggle-btn i {
    font-size: 1rem;
}

/* محتوى داخل الصفحة */
.app-content {
    padding: 1.5rem;
}

/* Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background-color: var(--bg-secondary);
    border-radius: var(--card-radius);
    padding: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.stat-card .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-card .icon {
    font-size: 1.6rem;
}

/* جداول */
.card {
    background-color: var(--bg-secondary);
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

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

.card-title {
    margin: 0;
    font-size: 0.95rem;
}

.card-body {
    padding: 0.9rem 1rem;
}

.table {
    font-size: 0.85rem;
}

.table thead th {
    background-color: var(--bg-color);
}

/* Alerts للفلاش */
.alert {
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #b91c1c;
}

.alert-success {
    background-color: #dcfce7;
    color: #15803d;
}

/* RTL تعديل بسيط */
body[dir="rtl"] .app-sidebar .nav a:hover,
body[dir="rtl"] .app-sidebar .nav a.active {
    transform: translateX(2px);
}

/* زر خروج صغير */
.btn-logout {
    font-size: 0.8rem;
}

/* زر فتح السايدبار */
.sidebar-toggle {
    color: #fff !important;       /* لون الأيقونة */
    background: #d40000 !important; /* لون الخلفية */
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 1.4rem;
    border: none;
    transition: 0.2s;
}

.sidebar-toggle:hover {
    background: #b30000 !important; /* أغمق شوي عند اللمس */
}

.sidebar-toggle i {
    color: #fff !important; /* أيقونة */
}

/* صفحة داخلية عامة (مثل my_rides) */
.page-wrapper {
    padding: 1.25rem;
}

/* الهيدر الصغير داخل الصفحة */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}

.page-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.page-header-subtitle {
    font-size: .8rem;
    color: #6b7280;
}

/* كرت يحتوي الجدول */
.card-table {
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
    overflow: hidden;
}

/* جدول أنظف */
.table-rides {
    margin-bottom: 0;
    font-size: .82rem;
}

.table-rides thead {
    background: #f9fafb;
}

.table-rides thead th {
    border-bottom-color: #e5e7eb;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}

.table-rides tbody tr:hover {
    background: #f9fafb;
}

.table-rides td,
.table-rides th {
    vertical-align: middle;
    padding-top: .6rem;
    padding-bottom: .6rem;
}

/* حالة الرحلة كبادج أوضح */
.badge-ride-status {
    border-radius: 999px;
    padding: .25rem .6rem;
    font-size: .75rem;
}

/* زر عرض التفاصيل في الجدول */
.btn-ride-sm {
    padding: .2rem .55rem;
    font-size: .75rem;
    border-radius: 999px;
}

