/**
 * DosiPlot v5.0 — Simulation Monte Carlo Interactive
 * © 2025 Pr. Yassine OULHOUQ
 * Université Mohammed Premier (UMP) — Oujda, Maroc
 * Module: TP Modules — Dashboard Layout, Cards, Inputs, Feedback, Scores
 */

/* ============================================
   TP TAB BUTTON OVERRIDE
   ============================================ */
.tp-tab {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #fff !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.tp-tab:hover {
  background: linear-gradient(135deg, #047857, #065f46) !important;
}

/* ============================================
   TP DASHBOARD LAYOUT
   ============================================ */
/* .tp-dashboard styles applied only when active (via .tc.active) */
.tc.tp-dashboard.active {
  flex-direction: column;
  gap: 20px;
  padding: 4px;
  overflow-y: auto;
}

/* ============================================
   TP HEADER BANNER
   ============================================ */
.tp-header {
  border-radius: 14px;
  padding: 24px 28px 18px;
  position: relative;
  overflow: visible;
  margin-bottom: 0;
  flex-shrink: 0;
}

.tp-header::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.06;
  border-radius: inherit;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    currentColor 20px,
    currentColor 21px
  );
  pointer-events: none;
  clip-path: inset(0 round 14px);
}

.tp-header-photon {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.08) 50%, rgba(59, 130, 246, 0.04) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #3b82f6;
}

.tp-header-electron {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.08) 50%, rgba(16, 185, 129, 0.04) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
}

.tp-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.tp-header-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.tp-header-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.tp-header h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--t1);
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}

.tp-header-desc {
  font-size: 12px;
  color: var(--t2);
  margin: 0;
  line-height: 1.5;
}

/* ============================================
   TP HEADER SCORE BADGE
   ============================================ */
.tp-header-score {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 18px;
  text-align: center;
  min-width: 80px;
  flex-shrink: 0;
  transition: all 0.3s ease;
  opacity: 0.5;
}

.tp-header-score.has-score {
  opacity: 1;
  border-color: var(--border2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tp-score-label {
  font-size: 9px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--t3);
  margin-bottom: 2px;
}

.tp-score-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--t2);
  transition: color 0.3s;
}

.tp-score-value.excellent { color: #10b981; }
.tp-score-value.good { color: #3b82f6; }
.tp-score-value.needs-work { color: #f59e0b; }
.tp-score-value.poor { color: #ef4444; }

/* ============================================
   TP PROGRESS BAR
   ============================================ */
.tp-progress-bar {
  height: 6px;
  background: var(--bg2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.tp-header-photon .tp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 3px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.tp-header-electron .tp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 3px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   TP WORKFLOW STEPS
   ============================================ */
.tp-header-workflow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.tp-workflow-step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--t2);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px 3px 4px;
}

.tp-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}

.tp-header-photon .tp-step-icon {
  background: #3b82f6;
}

.tp-header-electron .tp-step-icon {
  background: #10b981;
}

.tp-workflow-arrow {
  font-size: 10px;
  color: var(--t3);
  flex-shrink: 0;
}

/* ============================================
   TP HEADER NOTE
   ============================================ */
.tp-header .mv-note,
.tp-header .eprof-depth-note {
  position: relative;
  z-index: 1;
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.5;
}

/* ============================================
   TP CARDS GRID
   ============================================ */
.tp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .tp-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   TP CARD
   ============================================ */
.tp-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.tp-card:hover {
  border-color: var(--border2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* ============================================
   TP CARD HEADER
   ============================================ */
.tp-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.tp-card-header.photon-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.02));
}

.tp-card-header.electron-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
}

.tp-card-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.photon-card .tp-card-num {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.electron-card .tp-card-num {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.tp-card-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--t1);
  line-height: 1.3;
}

/* ============================================
   TP CARD BODY
   ============================================ */
.tp-card-body {
  padding: 16px;
}

.tp-card-desc {
  font-size: 11px;
  color: var(--t2);
  line-height: 1.5;
  margin: 0 0 14px;
}

/* ============================================
   TP CARD INPUTS (2-COLUMN GRID)
   ============================================ */
.tp-card-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 500px) {
  .tp-card-inputs {
    grid-template-columns: 1fr;
  }
}

.tp-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tp-input-group label {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-input-group .tp-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg0);
  color: var(--t1);
  font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
  text-align: center;
  transition: all 0.2s ease;
}

.tp-input-group .tp-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.electron-card ~ .tp-card-body .tp-input:focus,
.tp-header-electron ~ .tp-grid .tp-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Sub-question within card */
.tp-card-sub-q {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--t2);
  margin: 4px 0 0;
  line-height: 1.4;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* Note within card */
.tp-card-note {
  grid-column: 1 / -1;
  font-size: 10px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1.5;
}

/* ============================================
   TP CHECK BUTTONS (in cards)
   ============================================ */
.tp-btn-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.tp-btn-check.photon-card,
.tp-btn-check.photon-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.tp-btn-check.photon-card:hover,
.tp-btn-check.photon-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tp-btn-check.electron-card {
  background: linear-gradient(135deg, #10b981, #059669);
}

.tp-btn-check.electron-card:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tp-btn-check:active {
  transform: translateY(0);
}

/* Ripple effect on check */
.tp-btn-check::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.tp-btn-check:active::after {
  opacity: 1;
}

/* Export button */
.tp-btn-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 12px;
}

.tp-btn-export:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

/* ============================================
   TP FEEDBACK MESSAGES (in cards)
   ============================================ */
.tp-feedback {
  font-size: 11px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  display: none;
  font-family: 'IBM Plex Mono', monospace;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  line-height: 1.6;
}

.tp-feedback.correct {
  display: block;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.tp-feedback.wrong {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.tp-feedback.info {
  display: block;
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.tp-fb-line {
  padding: 2px 0;
}

.tp-fb-line strong {
  font-weight: 600;
}

/* ============================================
   TP SYNTHESIS QUESTIONS (Phase 5)
   ============================================ */
.tp-card-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.tp-synth-q {
  font-size: 11px;
  color: var(--t2);
  line-height: 1.5;
  padding: 6px 10px;
  background: var(--bg2);
  border-radius: 6px;
  border-left: 3px solid rgba(16, 185, 129, 0.4);
}

/* ============================================
   TP SIDEBAR STYLES (kept for backwards compat)
   ============================================ */
.tp-phase {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg2);
  transition: border-color 0.3s ease;
}

.tp-phase:hover {
  border-color: var(--border2);
}

.tp-phase-title {
  font-weight: 700;
  font-size: 12px;
  color: #10b981;
  margin-bottom: 6px;
  font-family: 'IBM Plex Mono', monospace;
}

.tp-phase-title.photon-title {
  color: #3b82f6;
}

.tp-question {
  font-size: 10px;
  color: var(--t2);
  margin: 4px 0;
  line-height: 1.4;
}

/* Old sidebar input rows */
.tp-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  flex-wrap: wrap;
}

.tp-input-row label {
  font-size: 10px;
  color: var(--t2);
  min-width: 90px;
  font-family: 'IBM Plex Mono', monospace;
}

/* Generic input styles */
.tp-input {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg0);
  color: var(--t1);
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  text-align: center;
  transition: all 0.2s ease;
}

.tp-input:focus {
  border-color: #10b981;
  outline: none;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* ============================================
   TP SCORE DISPLAY (sidebar)
   ============================================ */
.tp-score {
  text-align: center;
  padding: 12px;
  margin-top: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tp-score-val {
  font-size: 24px;
  font-weight: 700;
  color: #10b981;
  font-family: 'IBM Plex Mono', monospace;
}

/* ============================================
   TP NOTES / HINTS
   ============================================ */
.tp-note {
  font-size: 10px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 6px;
  padding: 8px;
  margin: 8px 0;
  line-height: 1.5;
}

.tp-note strong {
  color: #fbbf24;
}

/* ============================================
   TP SEPARATOR
   ============================================ */
.tp-separator {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ============================================
   LIGHT MODE OVERRIDES
   ============================================ */
body.light-mode .tp-header-photon {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(37, 99, 235, 0.06) 50%, rgba(59, 130, 246, 0.02) 100%);
  border-color: rgba(59, 130, 246, 0.2);
}

body.light-mode .tp-header-electron {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.06) 50%, rgba(16, 185, 129, 0.02) 100%);
  border-color: rgba(16, 185, 129, 0.2);
}

body.light-mode .tp-card {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

body.light-mode .tp-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
