/* ============================================
   Dashboard Styles — Teacher Dashboard
   Imported AFTER variables.css and components.css
   ============================================ */

/* ─── 1. Layout ─────────────────────────────── */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  direction: ltr;
}

.main-content {
  flex: 1;
  margin-right: 260px;
  margin-left: 0;
  padding: calc(var(--navbar-height) + 28px) 32px 32px;
  min-height: 100vh;
  background: var(--bg-secondary, #F8FAFC);
  box-sizing: border-box;
}

[dir="ltr"] .main-content {
  margin-right: 0;
  margin-left: 260px;
}

/* ─── 2. Sidebar ────────────────────────────── */

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-primary, #FFFFFF);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="ltr"] .sidebar {
  right: auto;
  left: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  border-left: none;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.sidebar-logo span {
  font-size: 17px;
  font-weight: normal;
  color: var(--text-primary, #0F172A);
  letter-spacing: 0.2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
}

.sidebar-nav .nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md, 12px);
  font-size: var(--text-sm, 14px);
  color: var(--text-secondary, #475569);
  cursor: pointer;
  transition: all var(--transition-base, 250ms ease);
  text-decoration: none;
  user-select: none;
}

.sidebar-nav .nav-link i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  color: var(--text-muted, #94A3B8);
  transition: color var(--transition-base, 250ms ease);
}

.sidebar-nav .nav-link span {
  flex: 1;
}

.sidebar-nav .nav-link:hover {
  background-color: var(--bg-secondary, #F8FAFC);
  color: var(--text-primary, #0F172A);
}

.sidebar-nav .nav-link:hover i {
  color: var(--color-primary, #2563EB);
}

.sidebar-nav .nav-item.active .nav-link,
.sidebar-nav .nav-link.active {
  background: var(--gradient-hero, linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%));
  color: var(--text-inverse, #FFFFFF);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sidebar-nav .nav-item.active .nav-link i,
.sidebar-nav .nav-link.active i {
  color: var(--text-inverse, #FFFFFF);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color, #E2E8F0);
  flex-shrink: 0;
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md, 12px);
  font-size: var(--text-sm, 14px);
  font-family: inherit;
  color: var(--color-danger, #EF4444);
  cursor: pointer;
  transition: all var(--transition-base, 250ms ease);
  user-select: none;
}

.sidebar-logout-btn i {
  font-size: 16px;
  transition: transform var(--transition-base, 250ms ease);
}

.sidebar-logout-btn:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

.sidebar-logout-btn:hover i {
  transform: translateX(-4px);
}

[dir="rtl"] .sidebar-logout-btn:hover i {
  transform: translateX(4px);
}

/* Sidebar mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

/* Mobile hamburger */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-primary, #FFFFFF);
  border: 1px solid rgba(0, 0, 0, 0.1);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-primary, #0F172A);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.sidebar-toggle:active {
  transform: scale(0.93);
}

/* ─── 3. Overview Cards ─────────────────────── */

.overview-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.overview-card {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .overview-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
    transform: translateY(-2px);
  }
}

.overview-card .card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.overview-card .card-info {
  flex: 1;
  text-align: left;
}

.overview-card .card-value {
  font-size: 24px;
  font-weight: normal;
  color: var(--text-primary, #0F172A);
  line-height: 1.2;
}

.overview-card .card-label {
  font-size: 13px;
  color: #888;
  margin-top: 2px;
}

/* Card color variants */
.overview-card.card-primary .card-icon {
  background: rgba(156, 140, 123, 0.12);
  color: var(--color-primary, #2563EB);
}

.overview-card.card-success .card-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.overview-card.card-info .card-icon {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.overview-card.card-warning .card-icon {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

/* ─── 4. Exam Builder ───────────────────────── */

.builder-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.builder-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.builder-preview {
  position: sticky;
  top: 28px;
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: hidden;
  min-height: 300px;
}

.builder-section {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.builder-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--color-primary, #2563EB);
  color: #ffffff;
  cursor: pointer;
  user-select: none;
}

.builder-section-header i {
  font-size: 14px;
  transition: transform 0.3s ease;
}

.builder-section.collapsed .builder-section-header i {
  transform: rotate(-90deg);
}

.builder-section-body {
  padding: 18px;
}

.builder-section.collapsed .builder-section-body {
  display: none;
}

/* Question item */
.question-item {
  background: #fafaf8;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-item:hover {
  border-color: rgba(156, 140, 123, 0.3);
}

.question-item.drag-handle {
  cursor: grab;
}

.question-item.drag-handle:active {
  cursor: grabbing;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.question-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.question-drag-icon {
  color: #bbb;
  font-size: 16px;
  cursor: grab;
  flex-shrink: 0;
}

.question-drag-icon:active {
  cursor: grabbing;
}

.question-number {
  background: var(--color-primary, #2563EB);
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.question-type-selector {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary, #0F172A);
  background: var(--bg-primary, #FFFFFF);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.question-type-selector:focus {
  border-color: var(--color-primary, #2563EB);
}

.question-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.06);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.question-delete-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Answer options */
.answer-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 10px;
}

.answer-option input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary, #0F172A);
  outline: none;
  transition: border-color 0.2s ease;
}

.answer-option input[type="text"]:focus {
  border-color: var(--color-primary, #2563EB);
}

.answer-correct-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.answer-correct-toggle input[type="radio"],
.answer-correct-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary, #2563EB);
  cursor: pointer;
}

.answer-correct-toggle span {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

.question-image-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 2px dashed rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
}

.question-image-upload:hover {
  border-color: var(--color-primary, #2563EB);
  color: var(--color-primary, #2563EB);
  background: rgba(156, 140, 123, 0.04);
}

.question-image-upload input[type="file"] {
  display: none;
}

/* Question actions bar */
.question-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.question-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.question-actions .btn-add-question {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.question-actions .btn-add-question:hover {
  background: #059669;
}

.question-actions .btn-import-question {
  background: rgba(156, 140, 123, 0.12);
  color: var(--color-primary, #2563EB);
}

.question-actions .btn-import-question:hover {
  background: rgba(156, 140, 123, 0.2);
}

/* ─── 5. Exam Table ─────────────────────────── */

.exam-table {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.exam-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.exam-table-header h3 {
  font-size: 16px;
  color: var(--text-primary, #0F172A);
  margin: 0;
}

.exam-search-input {
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary, #0F172A);
  outline: none;
  width: 220px;
  transition: border-color 0.2s ease;
}

.exam-search-input:focus {
  border-color: var(--color-primary, #2563EB);
}

.exam-table table {
  width: 100%;
  border-collapse: collapse;
}

.exam-table thead tr:first-child td {
  background: var(--color-primary, #2563EB);
  color: #ffffff;
  padding: 13px 18px;
  font-size: 14px;
  text-align: center;
  border: none;
}

.exam-table thead tr:nth-child(2) td {
  background: #f7f7f7;
  color: #666;
  font-size: 13px;
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.exam-table tbody tr td {
  padding: 12px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--text-primary, #0F172A);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--bg-primary, #FFFFFF);
  transition: background 0.15s ease;
}

.exam-table tbody tr:nth-child(even) td {
  background: #fcfcfc;
}

@media (hover: hover) {
  .exam-table tbody tr:hover td {
    background: #f4f8ff;
  }
}

/* Action buttons inside table */
.exam-table .actions-cell {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.exam-table .action-btn-sm {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.action-btn-sm.btn-edit {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.action-btn-sm.btn-edit:hover {
  background: #3b82f6;
  color: #ffffff;
}

.action-btn-sm.btn-results {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.action-btn-sm.btn-results:hover {
  background: #10b981;
  color: #ffffff;
}

.action-btn-sm.btn-copy {
  background: rgba(156, 140, 123, 0.12);
  color: var(--color-primary, #2563EB);
}

.action-btn-sm.btn-copy:hover {
  background: var(--color-primary, #2563EB);
  color: #ffffff;
}

.action-btn-sm.btn-delete {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}

.action-btn-sm.btn-delete:hover {
  background: #ef4444;
  color: #ffffff;
}

.action-btn-sm.btn-qr {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.action-btn-sm.btn-qr:hover {
  background: #8b5cf6;
  color: #ffffff;
}

/* ─── 6. Results Section ────────────────────── */

.results-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.results-selector {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-primary, #FFFFFF);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.results-selector label {
  font-size: 14px;
  color: var(--text-primary, #0F172A);
  white-space: nowrap;
}

.results-selector select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary, #0F172A);
  background: var(--bg-primary, #FFFFFF);
  outline: none;
  cursor: pointer;
}

.results-selector select:focus {
  border-color: var(--color-primary, #2563EB);
}

.results-table {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.results-table table {
  width: 100%;
  border-collapse: collapse;
}

.results-table thead tr td {
  background: var(--color-primary, #2563EB);
  color: #ffffff;
  padding: 13px 16px;
  font-size: 14px;
  text-align: center;
  border: none;
}

.results-table tbody tr td {
  padding: 12px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--text-primary, #0F172A);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--bg-primary, #FFFFFF);
}

.results-table tbody tr:nth-child(even) td {
  background: #fcfcfc;
}

@media (hover: hover) {
  .results-table tbody tr:hover td {
    background: #f4f8ff;
  }
}

.results-table .grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: normal;
  min-width: 42px;
}

.grade-badge.grade-excellent {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.grade-badge.grade-good {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.grade-badge.grade-average {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.grade-badge.grade-weak {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Ranking badge */
.ranking-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: normal;
}

.ranking-badge.rank-1 {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #ffffff;
}

.ranking-badge.rank-2 {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
  color: #ffffff;
}

.ranking-badge.rank-3 {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
}

.ranking-badge.rank-other {
  background: rgba(0, 0, 0, 0.05);
  color: #888;
}

/* Monitoring warnings */
.monitoring-warnings {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.monitoring-warnings h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: #f59e0b;
  margin: 0 0 12px 0;
}

.warning-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 13px;
  color: #666;
}

.warning-item:last-child {
  border-bottom: none;
}

.warning-item i {
  color: #f59e0b;
  flex-shrink: 0;
}

/* Export buttons */
.export-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--bg-primary, #FFFFFF);
  color: var(--text-primary, #0F172A);
  transition: all 0.2s ease;
}

.export-btn:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.18);
}

.export-btn i {
  font-size: 14px;
}

/* ─── 7. Statistics Section ─────────────────── */

.statistics-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-container {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.chart-container h4 {
  font-size: 15px;
  color: var(--text-primary, #0F172A);
  margin: 0 0 16px 0;
  text-align: left;
}

.chart-canvas-area {
  width: 100%;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-canvas-area canvas,
.chart-canvas-area svg {
  width: 100%;
  max-height: 300px;
}

/* Pro badge for locked features */
.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #ffffff;
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 0.3px;
}

.chart-locked-overlay {
  position: relative;
}

.chart-locked-overlay .chart-canvas-area {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.chart-locked-overlay .lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
}

.chart-locked-overlay .lock-overlay i {
  font-size: 28px;
  color: var(--color-primary, #2563EB);
}

.chart-locked-overlay .lock-overlay span {
  font-size: 14px;
  color: #666;
}

/* ─── 8. Subscription Section ───────────────── */

.subscription-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.plan-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.plan-card {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.plan-card .plan-name {
  font-size: 18px;
  color: var(--text-primary, #0F172A);
  margin-bottom: 6px;
}

.plan-card .plan-price {
  font-size: 32px;
  color: var(--text-primary, #0F172A);
  margin-bottom: 4px;
}

.plan-card .plan-period {
  font-size: 13px;
  color: #999;
  margin-bottom: 20px;
}

.plan-card .plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  text-align: right;
}

.plan-card .plan-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: #555;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.plan-card .plan-features li:last-child {
  border-bottom: none;
}

.plan-card .plan-features li i {
  color: #10b981;
  font-size: 13px;
  flex-shrink: 0;
}

.plan-card .plan-features li.disabled {
  color: #bbb;
}

.plan-card .plan-features li.disabled i {
  color: #ddd;
}

.plan-card .plan-btn {
  margin-top: auto;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  width: 100%;
}

/* Pro card with gradient border */
.plan-card.plan-pro {
  border: none;
  position: relative;
  background: var(--bg-primary, #FFFFFF);
}

.plan-card.plan-pro::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, #f59e0b, #f97316, #ef4444, #f59e0b);
  background-size: 300% 300%;
  animation: gradientShift 4s ease infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.plan-card.plan-pro .plan-badge {
  position: absolute;
  top: 14px;
  left: 14px;
}

.plan-card.plan-pro .plan-btn {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.plan-card.plan-pro .plan-btn:hover {
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.plan-card.plan-free .plan-btn {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary, #0F172A);
}

/* Active subscription info */
.subscription-info {
  background: var(--bg-primary, #FFFFFF);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* ─── 9. Auth Modal ────────────────────────── */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 9999);
  background: var(--bg-overlay, rgba(15, 23, 42, 0.6));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.auth-modal.active,
.auth-modal[style*="display: flex"],
.auth-modal[style*="display:flex"] {
  display: flex !important;
}

.auth-modal-content {
  background: var(--bg-card, #FFFFFF);
  border-radius: var(--radius-lg, 16px);
  padding: 36px 32px;
  width: 420px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  position: relative;
  text-align: center;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border-color, #E2E8F0);
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 24px;
  color: var(--text-muted, #94A3B8);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast, 150ms ease);
}

.auth-modal-close:hover {
  background-color: var(--bg-secondary, #F8FAFC);
  color: var(--text-primary, #0F172A);
  transform: rotate(90deg);
}

[dir="rtl"] .auth-modal-close {
  left: auto;
  right: 16px;
}

.auth-modal-title {
  font-size: var(--text-2xl, 1.5rem);
  font-weight: 700;
  color: var(--text-primary, #0F172A);
  margin-bottom: 24px;
}

.auth-social-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-social {
  width: 100%;
  justify-content: center;
  border: 1px solid var(--border-color, #E2E8F0) !important;
  color: var(--text-primary, #0F172A) !important;
  font-weight: 500 !important;
  border-radius: var(--radius-md, 12px) !important;
  background-color: var(--bg-primary, #FFFFFF);
  transition: all var(--transition-base, 0.2s ease) !important;
}

.btn-social:hover {
  background-color: var(--bg-secondary, #F8FAFC) !important;
  border-color: var(--text-secondary, #475569) !important;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted, #94A3B8);
  font-size: var(--text-xs, 12px);
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color, #E2E8F0);
}

.auth-form {
  text-align: right;
}

[dir="ltr"] .auth-form {
  text-align: left;
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-size: var(--text-sm, 14px);
  font-weight: 500;
  color: var(--text-secondary, #475569);
  margin-bottom: 6px;
}

.auth-form .form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-md, 12px);
  font-size: var(--text-sm, 14px);
  color: var(--text-primary, #0F172A);
  outline: none;
  background: var(--bg-primary, #FFFFFF);
  box-sizing: border-box;
  transition: all var(--transition-base, 250ms ease);
}

.auth-form .form-input:focus {
  border-color: var(--color-primary, #2563EB);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-block {
  width: 100%;
  border-radius: var(--radius-md, 12px) !important;
}

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.auth-links a {
  font-size: var(--text-sm, 14px);
  color: var(--color-primary, #2563EB);
  text-decoration: none;
  transition: color var(--transition-fast, 150ms ease);
}

.auth-links a:hover {
  color: var(--color-primary-dark, #1D4ED8);
  text-decoration: underline;
}

.subscription-info .sub-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subscription-info .sub-plan {
  font-size: 16px;
  color: var(--text-primary, #0F172A);
}

.subscription-info .sub-expiry {
  font-size: 13px;
  color: #888;
}

/* ─── 10. Auth Buttons ──────────────────────── */

.auth-btn-google,
.auth-btn-apple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 0;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: opacity 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.auth-btn-google:active,
.auth-btn-apple:active {
  transform: scale(0.97);
}

.auth-btn-google i,
.auth-btn-apple i {
  font-size: 18px;
}

.auth-btn-google {
  background: #ffffff;
  color: #444;
  border-color: #dadce0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-btn-google:hover {
  background: #f8f9fa;
}

.auth-btn-apple {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

.auth-btn-apple:hover {
  opacity: 0.88;
}

/* ─── 11. General Dashboard ─────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  color: var(--text-primary, #0F172A);
  margin: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #999;
}

.breadcrumb a {
  color: var(--color-primary, #2563EB);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb a:hover {
  color: #835003;
}

.breadcrumb .separator {
  color: #ccc;
  font-size: 10px;
}

.breadcrumb .current {
  color: #666;
}

.page-content {
  animation: fadeInPage 0.3s ease-out;
}

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

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  color: var(--color-primary, #2563EB);
  opacity: 0.4;
  margin-bottom: 16px;
  animation: floatEmpty 3s ease-in-out infinite;
}

@keyframes floatEmpty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.empty-state-text {
  font-size: 15px;
  color: #888;
  margin: 0 0 20px 0;
}

.empty-state-cta {
  background: var(--color-primary, #2563EB);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.empty-state-cta:active {
  transform: scale(0.96);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(255, 255, 255, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(156, 140, 123, 0.2);
  border-top-color: var(--color-primary, #2563EB);
  border-radius: 50%;
  animation: spinLoader 0.7s linear infinite;
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

/* ============================================
   RTL Support
   ============================================ */

[dir="rtl"] .main-content {
  margin-left: 260px;
  margin-right: 0;
}

[dir="rtl"] .sidebar {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

[dir="rtl"] .sidebar-toggle {
  right: auto;
  left: 14px;
}

[dir="rtl"] .exam-table thead tr td,
[dir="rtl"] .exam-table tbody tr td,
[dir="rtl"] .results-table thead tr td,
[dir="rtl"] .results-table tbody tr td {
  text-align: center;
}

[dir="rtl"] .overview-card .card-info {
  text-align: right;
}

[dir="rtl"] .chart-container h4 {
  text-align: right;
}

[dir="rtl"] .plan-card .plan-features li {
  text-align: right;
}

[dir="rtl"] .breadcrumb {
  direction: ltr;
  justify-content: flex-end;
}

[dir="rtl"] .results-selector {
  direction: rtl;
}

[dir="rtl"] .subscription-info {
  direction: rtl;
}

/* ============================================
   Responsive — Mobile
   ============================================ */

@media (max-width: 1024px) {
  .overview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .builder-layout {
    grid-template-columns: 1fr;
  }

  .builder-preview {
    position: static;
  }

  .plan-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
  }

  [dir="rtl"] .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-right: 0;
    margin-left: 0;
    padding: 20px 16px;
    padding-top: 60px;
  }

  [dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 0;
  }

  .overview-cards {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .overview-card {
    padding: 14px;
  }

  .overview-card .card-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .overview-card .card-value {
    font-size: 20px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .exam-table-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .exam-search-input {
    width: 100%;
  }

  .question-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .subscription-info {
    flex-direction: column;
    text-align: center;
  }

  .export-actions {
    justify-content: center;
  }

  .results-selector {
    flex-direction: column;
    align-items: stretch;
  }

  .results-table {
    overflow-x: auto;
  }

  .exam-table {
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .overview-cards {
    grid-template-columns: 1fr;
  }
}

/* ─── 12. Dropdowns ────────────────────────── */

/* Dropdown Container */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Dropdown Menu */
.dropdown-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  background-color: var(--bg-card, #FFFFFF);
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--border-color, #E2E8F0);
  z-index: 1000;
  padding: 8px 0;
  margin-bottom: 8px;
  animation: slideUp 0.2s ease;
}

[dir="ltr"] .dropdown-menu {
  right: auto;
  left: 0;
}

.dropdown-menu.show {
  display: block;
}

/* Dropdown Items */
.dropdown-item {
  width: 100%;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: transparent;
  color: var(--text-primary, #0F172A);
  font-size: var(--text-sm, 14px);
  font-family: inherit;
  text-align: right;
  cursor: pointer;
  transition: background-color var(--transition-fast, 150ms ease);
}

[dir="ltr"] .dropdown-item {
  text-align: left;
}

.dropdown-item i {
  color: var(--text-muted, #94A3B8);
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.dropdown-item:hover {
  background-color: var(--bg-secondary, #F8FAFC);
  color: var(--color-primary, #2563EB);
}

.dropdown-item:hover i {
  color: var(--color-primary, #2563EB);
}

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