/* ===================================================
   نظام حضور المتدربات - الأنماط العامة
   =================================================== */

:root {
  --primary: #223a4e;
  --primary-light: #34506b;
  --primary-dark: #16283a;
  --accent: #c4b693;
  --accent-dark: #a8976d;
  --success: #16a34a;
  --danger: #dc2626;
  --bg-soft: #f5f3ee;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Tajawal', 'Cairo', 'Inter', sans-serif;
  background: var(--bg-soft);
  color: #1f2937;
}

html[dir="ltr"] body { font-family: 'Inter', 'Tajawal', sans-serif; }

/* ===== Language Switcher ===== */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 4px;
  margin: 0 20px 16px;
}
.lang-switch button {
  flex: 1;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  transition: .2s;
}
.lang-switch button.active {
  background: var(--accent);
  color: #1f2937;
}
.lang-switch-top {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1eee5;
  border-radius: 999px;
  padding: 3px;
}
.lang-switch-top button {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
}
.lang-switch-top button.active {
  background: var(--primary);
  color: #fff;
}

/* ===== Sidebar ===== */
#app-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary-dark), var(--primary));
  color: #fff;
  min-height: 100vh;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 40;
  transition: transform .3s ease;
}
#app-sidebar .brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
#app-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #e9e5fb;
  font-weight: 500;
  border-right: 4px solid transparent;
  transition: all .2s;
}
#app-sidebar nav a:hover {
  background: rgba(255,255,255,.08);
}
#app-sidebar nav a.active {
  background: rgba(255,255,255,.14);
  border-right-color: var(--accent);
  color: #fff;
}
#app-sidebar nav a i { width: 20px; text-align: center; }

#main-content {
  margin-right: var(--sidebar-w);
  min-height: 100vh;
}

#mobile-topbar { display: none; }

@media (max-width: 1024px) {
  #app-sidebar { transform: translateX(100%); }
  #app-sidebar.open { transform: translateX(0); }
  #main-content { margin-right: 0; }
  #mobile-topbar { display: flex; }
}

/* ===== Cards ===== */
.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(34,58,78,.07);
  border: 1px solid #e9e4d6;
}
.page-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(34,58,78,.07);
  border: 1px solid #e9e4d6;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-present { background: #dcfce7; color: #166534; }
.badge-absent { background: #fee2e2; color: #991b1b; }
.badge-main { background: #e7e1d2; color: #223a4e; }
.badge-sub { background: #fef3c7; color: #92400e; }

table.data-table th {
  background: #eeeadf;
  color: var(--primary-dark);
  font-weight: 700;
  padding: 12px 14px;
  white-space: nowrap;
}
table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eeeadf;
  vertical-align: middle;
}
table.data-table tbody tr:hover { background: #f7f5ef; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 600;
  transition: .2s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 600;
  background: #fff;
}
.btn-outline:hover { background: #f5f3ff; }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items:center; justify-content:center;
  border-radius: 8px;
  transition: .2s;
}
.icon-btn.edit { background:#e7e1d2; color:#223a4e; }
.icon-btn.edit:hover { background:#dcd3ba; }
.icon-btn.delete { background:#fee2e2; color:#b91c1c; }
.icon-btn.delete:hover { background:#fecaca; }
.icon-btn.view { background:#eef4ee; color:#166534; }

.modal-overlay {
  position: fixed; inset:0; background: rgba(17,24,39,.55);
  display:flex; align-items:center; justify-content:center;
  z-index: 100; padding: 16px;
}
.modal-box {
  background: #fff; border-radius: 18px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.form-label { font-weight: 600; font-size: 13px; color:#4b5563; margin-bottom:4px; display:block;}
.form-input, .form-select, .form-textarea {
  width: 100%; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 9px 12px; font-size: 14px; background:#fafaff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(34,58,78,.15);
}

.tab-btn {
  padding: 9px 18px; border-radius: 10px; font-weight: 600; color:#6b7280;
}
.tab-btn.active { background: var(--primary); color:#fff; }

.toast {
  position: fixed; bottom: 24px; left: 24px; z-index: 200;
  background: #111827; color:#fff; padding: 12px 20px; border-radius: 12px;
  font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: slideUp .25s ease;
}
html[dir="ltr"] .toast { left: auto; right: 24px; }
@keyframes slideUp { from{opacity:0; transform: translateY(10px);} to{opacity:1; transform:none;} }

.empty-state { text-align:center; padding: 60px 20px; color:#9ca3af; }

.chip {
  display:inline-block; padding: 2px 10px; border-radius: 999px; font-size:12px; font-weight:600;
  background:#f3f4f6; color:#4b5563;
}

.progress-bar-track { background:#eeeadf; border-radius:999px; height:8px; overflow:hidden; }
.progress-bar-fill { height:100%; border-radius:999px; }

/* ===== Brand color utility classes (replace old purple/amber Tailwind classes) ===== */
.text-brand { color: var(--primary) !important; }
.text-brand-light { color: var(--primary-light) !important; }
.text-accent { color: var(--accent-dark) !important; }
.bg-brand-soft { background: #e7e1d2 !important; }
.text-brand-soft { color: var(--primary) !important; }
.bg-accent-soft { background: #f3ecd9 !important; }
.avatar-circle {
  background: #e7e1d2; color: var(--primary);
}

/* ===== RTL / LTR direction helpers ===== */
html[dir="rtl"] #app-sidebar { right: 0; left: auto; }
html[dir="ltr"] #app-sidebar { left: 0; right: auto; }
html[dir="ltr"] #main-content { margin-right: 0; margin-left: var(--sidebar-w); }
html[dir="ltr"] #app-sidebar nav a { border-right: none; border-left: 4px solid transparent; }
html[dir="ltr"] #app-sidebar nav a.active { border-left-color: var(--accent); }
@media (max-width: 1024px) {
  html[dir="ltr"] #app-sidebar { transform: translateX(-100%); }
  html[dir="ltr"] #app-sidebar.open { transform: translateX(0); }
  html[dir="ltr"] #main-content { margin-left: 0; }
}
html[dir="ltr"] table.data-table th,
html[dir="ltr"] table.data-table td { text-align: left; }

/* ===== Clinical Assessment Logbook ===== */
.rating-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.rating-excellent { background: #dcfce7; color: #166534; }
.rating-competent { background: #e7e1d2; color: #223a4e; }
.rating-developing { background: #f3ecd9; color: #7c6a3f; }
.rating-needs { background: #fef3c7; color: #92400e; }
.rating-none { background: #fee2e2; color: #991b1b; }

.rubric-score-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 13px;
}

.score-picker { display: flex; gap: 4px; }
.score-pick-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid #e5e7eb;
  background: #fff; font-weight: 700; font-size: 13px; color: #6b7280; transition: .15s;
}
.score-pick-btn.active { color: #fff; }
.score-pick-btn:hover:not(.active) { border-color: var(--primary-light); }

.clinical-stat-card {
  background: #fff; border-radius: 16px; padding: 18px; text-align: center;
  box-shadow: 0 2px 10px rgba(34,58,78,.07); border: 1px solid #e9e4d6;
}
.clinical-stat-card .icon-wrap {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; margin: 0 auto 10px; font-size: 18px;
}

.session-topic-card {
  background: #fff; border-radius: 16px; padding: 18px; box-shadow: 0 2px 10px rgba(34,58,78,.07);
  border: 1px solid #e9e4d6; transition: .2s; cursor: pointer;
}
.session-topic-card:hover { box-shadow: 0 8px 24px rgba(34,58,78,.12); transform: translateY(-2px); }

.rubric-collapsible { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.rubric-collapsible.open { max-height: 600px; }

.mini-chart-wrap { position: relative; height: 220px; }
