/* ===== PRACTICAL EXAM MODULE ===== */
/* Dark theme (default) + Light theme toggle */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --text-primary: #f0f0f0;
  --text-secondary: #b0b0b0;
  --accent: #FF9100;
  --accent-hover: #ffb347;
  --danger: #C1272D;
  --warning: #F7931E;
  --success: #006837;
  --border: #2a2a2a;
  --shadow: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f0;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --accent: #e67e00;
  --accent-hover: #ff9900;
  --danger: #c0392b;
  --warning: #e67e22;
  --success: #27ae60;
  --border: #dddddd;
  --shadow: rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
}

body.overlay-open {
  overflow: hidden;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ===== LAYOUT ===== */
.practical-app {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 14px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.practical-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  margin: -16px -14px 20px -14px;
  background: linear-gradient(135deg, rgba(255, 145, 0, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: 10px;
  color: #000;
  flex-shrink: 0;
}

.header-logo svg {
  width: 24px;
  height: 24px;
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.practical-header h1 {
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  color: var(--accent);
  font-weight: 700;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

[dir="rtl"] .practical-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .header-controls {
  flex-direction: row-reverse;
}

[dir="rtl"] .header-brand {
  flex-direction: row-reverse;
}

[dir="rtl"] .detail-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .error-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .phase-label {
  justify-content: flex-end;
}

[dir="rtl"] .qv-header {
  flex-direction: row-reverse;
}

/* ===== FOOTER ===== */
.practical-footer {
  margin: auto -14px -24px -14px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 145, 0, 0.06) 0%, transparent 100%);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.footer-logo {
  font-size: 18px;
}

.footer-name {
  font-size: 14px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.footer-divider {
  opacity: 0.4;
}

[dir="rtl"] .footer-content {
  flex-direction: row-reverse;
}

[dir="rtl"] .footer-brand {
  flex-direction: row-reverse;
}

[dir="rtl"] .footer-links {
  flex-direction: row-reverse;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--accent);
  color: #000;
}

.lang-switcher {
  display: flex;
  gap: 4px;
}

.lang-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s;
  min-width: 36px;
}

.lang-btn:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.lang-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  cursor: default;
}

.lang-btn:disabled,
.lang-btn[disabled] {
  opacity: 0.75;
  cursor: default;
}

.back-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.back-btn:hover {
  background: var(--accent);
  color: #000;
}

/* ===== STATS BAR ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.stat-value {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== FILTERS ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active:hover {
  color: #000;
}

/* ===== ERROR CARDS (LIST VIEW) ===== */
.errors-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 80px;
}

.error-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.error-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.error-card.error-card--empty {
  cursor: default;
}

.error-title,
.error-scenario,
.phase-content,
.qv-text,
.qv-answer-text,
.turbo-tip-text {
  word-break: break-word;
}

.error-card.mastered {
  border-left: 4px solid var(--success);
}

.error-card.marked {
  border-left: 4px solid var(--danger);
}

[dir="rtl"] .error-card.mastered {
  border-right: 4px solid var(--success);
  border-left: none;
}

[dir="rtl"] .error-card.marked {
  border-right: 4px solid var(--danger);
  border-left: none;
}

.error-severity {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.severity-schwer {
  background: var(--danger);
  color: white;
}

.severity-mittel {
  background: var(--warning);
  color: white;
}

.severity-leicht {
  background: var(--success);
  color: white;
}

.error-title {
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.error-scenario {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 10px;
}

.error-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.error-progress {
  font-size: 12px;
  color: var(--text-secondary);
}

.error-actions {
  display: flex;
  gap: 6px;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== DETAIL VIEW ===== */
.detail-view {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.detail-view.active {
  display: flex;
  animation: slideIn 0.25s ease both;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

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

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.detail-nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--accent);
  color: #000;
}

/* ===== PHASE CARDS ===== */
.phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  position: relative;
}

.phase-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.phase-label::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.phase-title {
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
}

.phase-content {
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

.phase-content strong {
  color: var(--text-primary);
}

/* Danger box */
.danger-box {
  background: rgba(193, 39, 45, 0.1);
  border-left: 4px solid var(--danger);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
}

[dir="rtl"] .danger-box {
  border-right: 4px solid var(--danger);
  border-left: none;
  border-radius: 8px 0 0 8px;
}

.danger-box strong {
  color: var(--danger);
}

/* Legal box */
.legal-box {
  background: rgba(255, 145, 0, 0.08);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
}

[dir="rtl"] .legal-box {
  border-right: 4px solid var(--accent);
  border-left: none;
  border-radius: 8px 0 0 8px;
}

.legal-box strong {
  color: var(--accent);
}

/* Turbo tip */
.turbo-tip-box {
  background: linear-gradient(135deg, rgba(255, 145, 0, 0.15), rgba(255, 145, 0, 0.05));
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  text-align: center;
}

.turbo-tip-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.turbo-tip-text {
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
  color: var(--accent);
  font-style: italic;
}

/* Fix tips list */
.fix-list {
  list-style: none;
  margin: 12px 0;
}

.fix-list li {
  padding: 8px 0 8px 28px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.fix-list li:last-child {
  border-bottom: none;
}

.fix-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 800;
}

[dir="rtl"] .fix-list li {
  padding: 8px 28px 8px 0;
}

[dir="rtl"] .fix-list li::before {
  left: auto;
  right: 0;
}

/* ===== THEORY LINKS ===== */
.theory-links {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.theory-links-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.theory-q-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theory-q-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.theory-q-badge:hover {
  background: var(--accent);
  color: #000;
}

/* ===== CONFIDENCE BUTTONS ===== */
.confidence-bar {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.confidence-btn {
  flex: 1;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s;
  text-align: center;
}

.confidence-btn:hover {
  transform: scale(1.02);
}

.confidence-btn.unsure {
  border-color: var(--danger);
  color: var(--danger);
}

.confidence-btn.unsure:hover {
  background: var(--danger);
  color: white;
}

.confidence-btn.sure {
  border-color: var(--success);
  color: var(--success);
}

.confidence-btn.sure:hover {
  background: var(--success);
  color: white;
}

/* ===== PROGRESS BAR ===== */
.progress-track {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ===== HIDDEN ===== */
.hidden {
  display: none !important;
}

/* ===== LIST VIEW ===== */
.list-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-view.hidden {
  display: none;
}

/* ===== QUESTION OVERLAY (original theory test design) ===== */
.question-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.question-viewer {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.qv-header {
  background: #008000;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px 12px 0 0;
  font-weight: 700;
}

.qv-qid {
  font-size: 16px;
  letter-spacing: 0.5px;
}

.qv-close {
  background: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.qv-close:hover {
  background: #ff4444;
  color: white;
}

.qv-body {
  padding: 20px;
  color: #1a1a1a;
  flex: 1;
  overflow-y: auto;
}

.qv-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.5;
  text-align: left;
}

[dir="rtl"] .qv-text,
[dir="rtl"] .qv-answer-text,
[dir="rtl"] .qv-info,
[dir="rtl"] .phase-content,
[dir="rtl"] .error-scenario,
[dir="rtl"] .theory-links-title,
[dir="rtl"] .phase-title {
  text-align: right;
}

.qv-media {
  margin-bottom: 16px;
  text-align: center;
}

.qv-media img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  cursor: pointer;
  object-fit: contain;
}

.qv-media video {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
}

.qv-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qv-answer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: white;
  border-radius: 8px;
  border: 2px solid #ccc;
  cursor: default;
  text-align: left;
  font-size: 15px;
}

.qv-answer.correct {
  border-color: #008000;
  background: #e8f5e9;
}

.qv-answer.wrong {
  border-color: #c1272d;
  background: #ffebee;
}

.qv-answer-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  min-width: 28px;
}

.qv-answer.correct .qv-answer-icon {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.qv-answer.wrong .qv-answer-icon {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.qv-answer-text {
  flex: 1;
}

.qv-info {
  margin-top: 16px;
  padding: 14px;
  background: white;
  border-radius: 8px;
  border-left: 4px solid #008000;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
}

.qv-info-title {
  font-weight: 700;
  color: #008000;
  margin-bottom: 6px;
}

.qv-footer {
  background: #389149;
  color: white;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 12px 12px;
  font-size: 14px;
  font-weight: 600;
}

.qv-category {
  opacity: 0.9;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .practical-app {
    padding: 10px;
  }
  
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .practical-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    padding: 14px 16px;
  }

  .header-controls {
    justify-content: space-between;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  
  .confidence-bar {
    flex-direction: column;
  }
  
  .detail-header {
    flex-direction: column;
  }
  
  .error-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (min-width: 768px) {
  .errors-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Landscape on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .practical-app {
    padding: 8px;
    max-width: 100%;
  }
  
  .phase-card {
    padding: 12px;
  }
  
  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 8px;
  }
  
  .stat-item {
    padding: 6px;
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
