/* ========================================================
   DEST (Digital Education Skills for Teachers) Core CSS
   Academic Modern Design System - Arabic & RTL Native
   ======================================================== */

:root {
    --primary: #0f2744;
    --primary-light: #16365c;
    --primary-dark: #0a1b2f;
    --digital-blue: #1d68bd;
    --accent: #0ea5e9;
    --bg-canvas: #f8fafc;
    --bg-surface: #ffffff;
    --bg-muted: #f1f5f9;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-sans: 'Cairo', system-ui, -apple-system, sans-serif;
}

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

html, body {
    direction: rtl;
    text-align: right;
    font-family: var(--font-sans);
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary);
    font-weight: 700;
    line-height: 1.3;
}

a {
    color: var(--digital-blue);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary);
}

/* Container & Grid */
.dest-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.dest-navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-crest {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--digital-blue));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(15, 39, 68, 0.25);
}

.brand-text h1 {
    font-size: 16px;
    color: var(--primary);
    margin: 0;
}

.brand-text p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
}

.nav-menu a {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.nav-menu a:hover, .nav-menu a.active {
    color: var(--digital-blue);
    background: var(--bg-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-light);
    color: #fff;
}

.btn-accent {
    background: var(--digital-blue);
    color: #fff;
}
.btn-accent:hover {
    background: #17549c;
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 18px;
    color: var(--primary);
    margin: 0;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--digital-blue);
    box-shadow: 0 0 0 3px rgba(29, 104, 189, 0.15);
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.alert-error, .alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}
.alert-info {
    background: #f0f9ff;
    color: #075985;
    border: 1px solid #bae6fd;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9999px;
}

.badge-primary { background: #e0f2fe; color: #0369a1; }
.badge-success { background: var(--success-bg); color: #047857; }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-danger { background: var(--danger-bg); color: #b91c1c; }
.badge-secondary { background: var(--bg-muted); color: var(--text-secondary); }

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    border-right: 3px solid transparent;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    color: var(--digital-blue);
    background: #f0f7ff;
    border-right-color: var(--digital-blue);
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    background: var(--bg-canvas);
    overflow-y: auto;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-info h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.stat-info .stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    margin-top: 4px;
}

/* Roadmap Component */
.roadmap-container {
    position: relative;
    padding: 30px 20px;
}

.roadmap-line {
    position: absolute;
    top: 50px;
    bottom: 50px;
    right: 49px;
    width: 4px;
    background: #cbd5e1;
    z-index: 1;
}

.roadmap-step {
    position: relative;
    display: flex;
    gap: 24px;
    margin-bottom: 35px;
    z-index: 2;
}

.step-node {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 4px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.step-node.completed {
    background: var(--success);
    border-color: #059669;
    color: #fff;
}

.step-node.available {
    background: var(--digital-blue);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 6px rgba(29, 104, 189, 0.2);
}

.step-node.locked {
    background: var(--bg-muted);
    border-color: #e2e8f0;
    color: var(--text-muted);
}

.step-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    flex-grow: 1;
    box-shadow: var(--shadow-sm);
}

/* Exam Monitor UI */
.exam-header {
    background: var(--primary);
    color: #fff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.exam-timer {
    font-size: 20px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 16px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.anti-cheating-bar {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.dest-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--bg-surface);
}

.dest-table th {
    background: var(--bg-muted);
    color: var(--primary);
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
    text-align: right;
}

.dest-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.dest-table tr:hover {
    background-color: #f8fafc;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 39, 68, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.25s ease;
}

@keyframes modalSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Mobile responsive (Unified with Modern Drawer Architecture) */
@media (max-width: 992px) {
    .dashboard-wrapper {
        display: block !important;
        position: relative !important;
        width: 100% !important;
    }
    .main-content {
        width: 100% !important;
        padding: 16px 14px !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    .nav-menu {
        display: none !important;
    }
}
