/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary {
    background: #2563eb;
    color: #fff;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-full { width: 100%; text-align: center; }

/* ── Form ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
    background: #fff;
}
.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ── Auth Layout ─────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}
.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}
.auth-logo img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 12px;
}
.auth-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: #1e3a5f;
    line-height: 1.3;
}
.auth-logo .subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}
.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
}
.auth-link a { color: #2563eb; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

/* ── Sidebar Layout ──────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 250px;
    background: #1e3a5f;
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h2 {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
}
.sidebar-header p {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section {
    padding: 6px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: #60a5fa;
}
.nav-link .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}
.sidebar-footer a {
    color: #f87171;
    text-decoration: none;
    font-size: 13px;
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}
.page-header {
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1e3a5f;
}
.page-header p {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
}

/* ── Stats Grid ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #2563eb;
}
.stat-card .stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e3a5f;
    margin-top: 6px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 13px;
}
tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}
tbody tr:hover { background: #f8fafc; }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ── RTL Support ─────────────────────────────────────────── */
[dir="rtl"] .sidebar { border-left: none; }
[dir="rtl"] .nav-link { border-left: none; border-right: 3px solid transparent; }
[dir="rtl"] .nav-link:hover, [dir="rtl"] .nav-link.active { border-right-color: #60a5fa; }
[dir="rtl"] .stat-card { border-left: none; border-right: 4px solid #2563eb; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; }
    .layout  { flex-direction: column; }
    .main-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
