/* Répétition Espacée Panel Styles */

#repetitionPanel {
  padding: 0;
}

.repetition-container {
  padding: 20px;
}

.repetition-header {
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(59, 130, 246, 0.06));
}

.repetition-header .section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.repetition-header .section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* View Switcher Tabs */
.rep-view-tabs {
  display: flex;
  background: var(--bg-card);
  padding: 3px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  gap: 2px;
}

.rep-tab-btn {
  padding: 6px 14px;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.rep-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.rep-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Card Mini-Table Styling & Equal Height Cards */
#repetitionQcmsGrid.qcms-grid {
  align-items: stretch;
  gap: 12px;
}

#repetitionQcmsGrid .compact-card {
  background: var(--bg-card-solid, #131a2b) !important;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14)) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
  border-radius: 12px;
  padding: 10px;
  gap: 4px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

#repetitionQcmsGrid .compact-card {
  transform: none !important;
}

#repetitionQcmsGrid .compact-card:hover,
#repetitionQcmsGrid .compact-card:active,
#repetitionQcmsGrid .compact-card:focus {
  transform: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="light"] #repetitionQcmsGrid .compact-card {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.09) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06) !important;
}

html[data-theme="light"] #repetitionQcmsGrid .compact-card:hover,
html[data-theme="light"] #repetitionQcmsGrid .compact-card:active,
html[data-theme="light"] #repetitionQcmsGrid .compact-card:focus {
  transform: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
}

#repetitionQcmsGrid .compact-question {
  margin-bottom: 2px;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

#repetitionQcmsGrid .compact-tags {
  gap: 3px;
  margin-bottom: 2px;
  max-width: 100%;
}

#repetitionQcmsGrid .c-tag {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
  box-sizing: border-box;
}

#repetitionQcmsGrid .compact-stats {
  margin-bottom: 2px;
  padding: 4px 6px;
  gap: 6px;
}

#repetitionQcmsGrid .compact-footer {
  padding-top: 4px;
  margin-top: auto;
  border-top: 1px dashed var(--border-color);
}

.card-mini-table-wrapper {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  overflow-x: hidden;
}

.card-mini-table-wrapper:not([style*="display: none"]):not([style*="display:none"]) ~ .compact-footer,
.card-mini-table-wrapper:not([style*="display: none"]):not([style*="display:none"]) {
  margin-top: auto;
}

.card-mini-table-wrapper[style*="display: none"],
.card-mini-table-wrapper[style*="display:none"] {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

.card-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5px;
  text-align: left;
  table-layout: fixed;
}

.card-mini-table th:nth-child(1),
.card-mini-table td:nth-child(1) {
  width: 32%;
  padding: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-mini-table th:nth-child(2),
.card-mini-table td:nth-child(2) {
  width: 18%;
  text-align: center;
  padding: 2px;
}

.card-mini-table th:nth-child(3),
.card-mini-table td:nth-child(3) {
  width: 50%;
  padding: 2px;
  text-align: right;
  overflow: hidden;
}

.card-mini-table th {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

[data-theme="dark"] .card-mini-table th {
  background: rgba(255, 255, 255, 0.04);
}

.card-mini-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  color: var(--text-main);
  white-space: nowrap;
  vertical-align: middle;
}

.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 3px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .card-mini-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.card-mini-table tr:last-child td {
  border-bottom: none;
}

/* Date Badges in Mini-Table */
.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.2;
}

.date-badge-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.date-badge-today {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.date-badge-future {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.date-badge-none {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.res-correct {
  color: #22c55e;
  font-weight: 700;
}

.res-faute {
  color: #ef4444;
  font-weight: 700;
}

/* Vue 3 - Calendar View Styles */
.rep-calendar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-top: 10px;
}

.rep-calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.rep-calendar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.rep-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.rep-calendar-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 0;
  text-transform: uppercase;
}

.rep-calendar-day {
  min-height: 80px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.rep-calendar-day:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.rep-calendar-day.other-month {
  opacity: 0.35;
}

.rep-calendar-day.today {
  border: 2px solid var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.rep-calendar-day.selected {
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 0 2px var(--primary);
}

.rep-calendar-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.rep-calendar-day-badge {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 4px;
}

.rep-calendar-day-badge.due {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.rep-calendar-day-badge.future {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.rep-calendar-details-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Vue 4 - Global Table View Styles */
.rep-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow-x: auto;
  margin-top: 10px;
}

.rep-global-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.rep-global-table th {
  padding: 12px 14px;
  background: var(--bg-body);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.rep-global-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.rep-global-table tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}

/* Star Rating Component */
.star-rating-group {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}

.star-rating-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.star-rating-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  width: 14px;
}

.star-icon {
  font-size: 11px;
  color: var(--border-color);
  cursor: pointer;
  transition: color 0.15s ease;
}

.star-icon.filled {
  color: #f59e0b;
}

.star-icon:hover {
  transform: scale(1.2);
}

/* Repetition-specific empty state */
#repetitionQcmsGrid .empty-state i {
  color: var(--warning);
}

@media (max-width: 768px) {
  .repetition-container {
    padding: 16px;
  }

  .repetition-header {
    padding: 16px;
    border-radius: 18px;
  }

  .repetition-header .section-title {
    font-size: 24px;
  }

  .rep-calendar-container {
    padding: 12px 6px !important;
    border-radius: 14px !important;
  }

  .rep-calendar-nav {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
  }

  .rep-calendar-title {
    width: 100% !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    order: 1 !important;
    margin-bottom: 4px !important;
  }

  .rep-calendar-nav > div {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    order: 2 !important;
  }

  .rep-calendar-nav .btn {
    padding: 4px 7px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  .rep-calendar-grid {
    gap: 2px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .rep-calendar-day-header {
    font-size: 10px !important;
    padding: 4px 0 !important;
    text-align: center !important;
  }

  .rep-calendar-day {
    min-height: 48px !important;
    padding: 2px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  .rep-calendar-day-num {
    font-size: 10px !important;
    font-weight: 700 !important;
  }

  .rep-calendar-day-badge {
    font-size: 8px !important;
    padding: 1px 3px !important;
    margin-top: 2px !important;
    border-radius: 4px !important;
  }
}

/* =========================================================================
   Sleek & Compact Repetition Selection Bar (No Wasted Space)
   ========================================================================= */
.selection-actions-bar.repetition-selection-bar {
  background: var(--bg-card, #ffffff);
  border: 1.5px solid var(--primary, #3b82f6);
  border-radius: 12px;
  padding: 6px 14px;
  margin: 8px 0 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.12);
  box-sizing: border-box;
  flex-wrap: nowrap;
}

[data-theme="dark"] .selection-actions-bar.repetition-selection-bar {
  background: var(--bg-card-solid, #131a2b);
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.repetition-selection-bar .rep-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.repetition-selection-bar .rep-bar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary, #3b82f6);
  background: rgba(59, 130, 246, 0.1);
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  white-space: nowrap;
}

.repetition-selection-bar .rep-bar-badge i {
  font-size: 13px;
}

.repetition-selection-bar .rep-bar-cancel-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 4px 9px;
  height: 30px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.repetition-selection-bar .rep-bar-cancel-btn:hover {
  color: var(--danger, #ef4444);
  border-color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.08);
}

.repetition-selection-bar .rep-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 480px;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.repetition-selection-bar .rep-bar-input-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}

.repetition-selection-bar .rep-bar-input-box i {
  position: absolute;
  left: 10px;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.repetition-selection-bar #repetitionTestNameInput {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 28px;
  font-size: 12.5px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input, rgba(255, 255, 255, 0.05));
  color: var(--text-main);
  box-sizing: border-box;
  margin: 0;
}

.repetition-selection-bar #repetitionTestNameInput:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.repetition-selection-bar .rep-bar-launch-btn {
  height: 34px;
  padding: 0 16px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

@media (max-width: 640px) {
  .selection-actions-bar.repetition-selection-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    min-height: auto;
  }
  .repetition-selection-bar .rep-bar-left {
    justify-content: space-between;
  }
  .repetition-selection-bar .rep-bar-right {
    max-width: 100%;
  }
  .repetition-selection-bar .rep-bar-input-box {
    max-width: 100%;
  }
}
