/* ==========================================================================
   DASHBOARD.CSS - أنماط لوحة التحكم والصفحات الداخلية
   ========================================================================== */

/* --- ترويسة الصفحة (Page Header) --- */
.page-header {
  background: linear-gradient(135deg, var(--bg-alt) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 2rem;
  margin: -0.75rem -2rem 1.5rem -2rem;
}
.page-title-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

/* --- بطاقات الاختصارات السريعة (Shortcut Cards) --- */
.shortcut-card {
  text-decoration: none;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}
.shortcut-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.shortcut-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.shortcut-title { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.shortcut-desc { font-size: 0.8rem; color: var(--text-muted); }

/* --- لوحة أدوات التطوير (Dev Tools Panel) --- */
.dev-panel {
  background: var(--bg-alt);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.dev-panel h4 { margin-bottom: 10px; }
.dev-panel ul {
  list-style: disc;
  padding-right: 20px;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 15px;
}
.dev-panel-actions {
  border-top: 1px solid var(--border);
  padding-top: 15px;
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- جدول الجلسة والكوكيز (Session & Cookies Table) --- */
.session-section { margin-bottom: 1.25rem; }
.session-heading { margin-bottom: 10px; font-size: 0.95rem; color: var(--text-muted); }
.session-heading code { font-size: 0.8rem; }
.session-table { font-size: 0.9rem; }
.session-label { font-weight: 600; width: 140px; white-space: nowrap; }
.ltr-cell { direction: ltr; text-align: left; }
.code-primary { color: var(--primary); }
.code-muted { font-size: 0.75rem; color: var(--text-muted); word-break: break-all; }
.inline-muted { margin-inline-start: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }

/* --- بطاقات الإحصائيات (Stat Cards) --- */
.stat-card { display: flex; align-items: flex-start; justify-content: space-between; padding: 1.5rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 0.25rem; }
.stat-label { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning-dark); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger-dark); }
.stat-icon.info { background: var(--info-light); color: var(--info-dark); }
.stat-icon.pink { background: var(--pink-light); color: var(--pink-dark); }

/* --- التبويبات (Tabs Component) --- */
.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 0.65rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: var(--font-menu);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text); background: var(--bg-alt); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; padding: 1.5rem 0; }
.tab-pane.active { display: block; animation: fadeIn 0.25s ease-out; }

/* --- التبويبات — تجاوب الجوال --- */
@media (max-width: 768px) {
  .tabs-nav {
    flex-direction: column;
    border-bottom: none;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .tab-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    border-right: 3px solid transparent;
    margin-bottom: 0;
    text-align: right;
  }
  .tab-btn:last-child { border-bottom: none; }
  .tab-btn.active {
    border-bottom-color: var(--border);
    border-right-color: var(--primary);
    background: var(--bg-alt);
  }
}

/* --- شريط مسار التنقل (Breadcrumbs) --- */
.breadcrumb-bar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 0.375rem 0;
  font-size: 0.85rem;
}
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.breadcrumb-item { display: flex; align-items: center; color: var(--text-muted); }
.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--danger); text-decoration: none; }
.breadcrumb-item.active { color: var(--text); font-weight: 500; }
.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  padding-inline-start: 0.5rem;
  padding-inline-end: 0.5rem;
  color: var(--text-muted);
  opacity: 0.5;
  user-select: none;
}

/* --- قسم النسخ الاحتياطي (Backup Section) --- */
.backup-section { margin-bottom: 1rem; }
.backup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.backup-header .session-heading { margin-bottom: 0; }
#backup-table tbody tr { transition: background 0.2s ease; }
#backup-table tbody tr:hover { background: var(--bg-alt); }
.badge-info {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm, 4px);
  font-size: 0.8rem;
  font-weight: 600;
}

/* --- جدول النسخ — تجاوب الجوال --- */
@media (max-width: 768px) {
  #backup-table th:nth-child(2),
  #backup-table td:nth-child(2) { display: none; }
}

/* --- مدير النظام التصميمي (Design System Manager Accordion) --- */
.appearance-section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--bg);
  overflow: hidden;
  transition: var(--transition);
}
.appearance-section-card[open] {
  box-shadow: var(--shadow-sm);
}
.appearance-section-header {
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg-alt);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}
.appearance-section-card[open] .appearance-section-header {
  border-bottom-color: var(--border);
}
.appearance-section-header::-webkit-details-marker {
  display: none;
}
.appearance-section-header::after {
  content: "▼";
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.appearance-section-card[open] .appearance-section-header::after {
  transform: rotate(180deg);
}
.appearance-section-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.appearance-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.color-picker-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.color-picker-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.color-picker-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.color-picker-input-native {
  width: 44px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  cursor: pointer;
  background: var(--bg);
  flex-shrink: 0;
}

/* --- Donut Chart Styles --- */
.chart-donut-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chart-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.chart-donut-container {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.chart-donut-graphic {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  position: relative;
}
.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* CSS rotation to align SVG segments start at top */
}
.donut-ring {
  stroke: var(--border);
}
.donut-segment {
  fill: none;
  stroke-linecap: round;
}
.donut-center-text {
  transform: rotate(90deg);
  transform-origin: center;
}
.donut-number {
  font-size: 5.5px;
  fill: var(--text);
}
.donut-label {
  font-size: 2px;
  fill: var(--text-muted);
}
.chart-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
  min-width: 200px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-label {
  font-weight: 500;
  flex-grow: 1;
}
.legend-value {
  font-weight: 700;
}
.legend-percent {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Bar Chart Styles --- */
.chart-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chart-bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.chart-bar-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  width: 130px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-bar-track {
  height: 12px;
  background: var(--border);
  border-radius: var(--radius);
  flex-grow: 1;
  overflow: hidden;
  position: relative;
}
.chart-bar-fill {
  height: 100%;
  border-radius: var(--radius);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.chart-bar-value {
  font-size: 0.88rem;
  color: var(--text);
  width: 70px;
  text-align: left;
  flex-shrink: 0;
}

/* --- Model Quran Circle Report --- */
.group-report-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-md);
  font-family: var(--font);
  direction: rtl;
}

.group-report-header {
  border-bottom: 2px solid var(--border);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

.group-report-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: linear-gradient(to left, #f8fafc, #ffffff);
  padding: 1rem;
  border-radius: var(--radius);
  border-right: 4px solid var(--primary);
  margin-bottom: 1.5rem;
}

.group-report-title-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.group-report-title-text h3 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
}

.group-report-badge {
  background: #064e3b;
  color: #ffffff;
  padding: 0.25rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-block;
}

.group-report-sub-badge {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: bold;
}

.group-meta-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

@media (max-width: 992px) {
  .group-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 576px) {
  .group-meta-grid {
    grid-template-columns: 1fr;
  }
}

.group-meta-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.group-meta-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.group-meta-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: bold;
}

.group-meta-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.group-meta-subvalue {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Row layouts for cards */
.group-cards-layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .group-cards-layout {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .group-cards-layout {
    grid-template-columns: 1fr;
  }
}

/* Individual mini cards */
.group-stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.group-stat-card.color-green { border-top: 4px solid #10b981; }
.group-stat-card.color-blue { border-top: 4px solid #3b82f6; }
.group-stat-card.color-purple { border-top: 4px solid #8b5cf6; }
.group-stat-card.color-gold { border-top: 4px solid #d97706; }

.group-stat-card-header {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.group-stat-card.color-green .group-stat-card-header { background: #10b981; }
.group-stat-card.color-blue .group-stat-card-header { background: #3b82f6; }
.group-stat-card.color-purple .group-stat-card-header { background: #8b5cf6; }
.group-stat-card.color-gold .group-stat-card-header { background: #d97706; }

.group-stat-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  text-align: center;
}

.group-stat-card-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.group-stat-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.group-stat-card-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Circular progress inside mini card */
.circle-progress-container {
  width: 70px;
  height: 70px;
  position: relative;
  margin-bottom: 0.5rem;
}

.circle-progress-svg {
  width: 100%;
  height: 100%;
}

.circle-progress-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 4;
}

.circle-progress-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.5s ease;
}

.circle-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
}

/* Layout for indicators row + big achievement card */
.group-indicators-layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 1rem;
}

@media (max-width: 992px) {
  .group-indicators-layout {
    grid-template-columns: 1fr;
  }
}

.group-indicators-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 576px) {
  .group-indicators-grid {
    grid-template-columns: 1fr;
  }
}

/* Large achievement card */
.group-achievement-card {
  background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  border: 1px solid #065f46;
}

.group-achievement-card::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  background: rgba(245, 158, 11, 0.05);
  border-radius: 50%;
}

.group-achievement-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #f59e0b;
}

.group-achievement-icon {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.group-achievement-value {
  font-size: 2.25rem;
  font-weight: 900;
  color: #ffffff;
  font-family: var(--font-title);
}

.group-achievement-subtext {
  font-size: 0.8rem;
  color: #a7f3d0;
  margin-top: 0.5rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  width: 100%;
}


/* =========================================================================
   شريط المعلومات الموحّد (التعاميم + الرسائل) — dash-info-bar
   ========================================================================= */
.dash-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.dash-info-bar__side {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.dash-info-bar__icon {
    width: 38px;
    height: 38px;
    font-size: 1.4rem;
    border-radius: var(--radius);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-info-bar__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.dash-info-bar__title {
    margin: 0;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}
.dash-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    min-width: 22px;
    text-align: center;
    background: var(--primary);
    color: var(--bg);
}
.dash-badge--unread { background: #ef4444; color: #fff; }
.dash-badge--read   { background: var(--bg-secondary, #e5e7eb); color: var(--text-muted); font-weight: 600; }
.dash-info-bar__btn { font-size: 0.82rem; padding: 0.3rem 0.85rem; border-radius: 9999px; white-space: nowrap; }
