/* ============================================================
   Training Test Plugin – style.css
   Sales Academy 2026 | Clean & Mobile-First Design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── ROOT VARIABLES ────────────────────────────────────────── */
:root {
  --clr-bg: #f4fbf8;
  --clr-surface: #ffffff;
  --clr-surface2: #f2f6ff;
  --clr-border: rgba(23, 51, 231, 0.14);
  --clr-text: #102347;
  --clr-muted: #5f7190;
  --clr-accent: #1733e7;
  --clr-accent2: #14c47d;
  --clr-green: #14c47d;
  --clr-green-bg: rgba(20, 196, 125, 0.14);
  --clr-red: #ef4444;
  --clr-red-bg: rgba(239, 68, 68, 0.12);
  --clr-gold: #f39b2f;
  --clr-silver: #8394b7;
  --clr-bronze: #ba7a4c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 30px rgba(23, 51, 231, 0.08);
  --font: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── RESET & BASE ──────────────────────────────────────────── */
.ttp-wrap * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.ttp-wrap {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100vh;
  padding: 20px 16px 60px;
  position: relative;
  overflow-x: hidden;
}

/* ── SCREENS ───────────────────────────────────────────────── */
.ttp-screen {
  display: none;
  max-width: 680px;
  margin: 0 auto;
  animation: ttpFadeIn 0.4s ease forwards;
}

.ttp-screen.active {
  display: block;
}

@keyframes ttpFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── HOME SCREEN ───────────────────────────────────────────── */
.ttp-header {
  text-align: center;
  padding: 40px 0 32px;
}

.ttp-badge {
  display: inline-block;
  background: var(--clr-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.ttp-title {
  font-size: clamp(36px, 8vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  color: var(--clr-text);
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.ttp-title span {
  color: var(--clr-accent2);
}

.ttp-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--clr-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ── CARD ──────────────────────────────────────────────────── */
.ttp-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.ttp-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--clr-muted);
  margin-bottom: 10px;
}

.ttp-input {
  width: 100%;
  background: var(--clr-surface2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  color: var(--clr-text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ttp-input::placeholder {
  color: var(--clr-muted);
}

.ttp-input:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.ttp-error {
  font-size: 13px;
  color: var(--clr-red);
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--clr-red-bg);
  border-radius: 8px;
}

.ttp-error.hidden {
  display: none;
}

/* ── BUTTONS ───────────────────────────────────────────────── */
.ttp-btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.ttp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.ttp-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition);
}

.ttp-btn:hover::after {
  background: rgba(255, 255, 255, 0.14);
}

.ttp-btn:active {
  transform: scale(0.98);
}

.btn-icon {
  font-size: 18px;
}

.ttp-btn-pre {
  background: #1733e7;
  color: #fff;
  box-shadow: 0 8px 18px rgba(23, 51, 231, 0.28);
}

.ttp-btn-post {
  background: #14c47d;
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 196, 125, 0.28);
}

.ttp-btn-rank {
  background: linear-gradient(135deg, #78350f, #f59e0b);
  color: #fff;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.ttp-btn-next {
  background: var(--clr-accent);
  color: #fff;
  margin-top: 20px;
  box-shadow: 0 8px 18px rgba(23, 51, 231, 0.28);
}

.ttp-btn.hidden {
  display: none;
}

/* ── TEST SCREEN ───────────────────────────────────────────── */
.ttp-test-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 0 20px;
}

.ttp-test-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 18px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--clr-accent);
  color: #fff;
  width: fit-content;
}

.ttp-test-type-badge.post {
  background: var(--clr-accent2);
}

.ttp-test-progress {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ttp-progress-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--clr-surface2);
  border-radius: 100px;
  overflow: hidden;
}

.ttp-progress-bar {
  height: 100%;
  background: var(--clr-accent);
  border-radius: 100px;
  width: 5%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#ttp-q-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}

.ttp-test-peserta {
  font-size: 13px;
  color: var(--clr-muted);
}

.ttp-test-peserta strong {
  color: var(--clr-text);
}

/* ── QUESTION ──────────────────────────────────────────────── */
.ttp-question-wrap {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.ttp-q-number {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--clr-accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  opacity: 0.8;
}

.ttp-q-text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--clr-text);
  margin-bottom: 24px;
}

/* ── OPTIONS ───────────────────────────────────────────────── */
.ttp-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ttp-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--clr-surface2);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--clr-text);
  line-height: 1.5;
  position: relative;
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
}

.ttp-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(23, 51, 231, 0);
  transition: background var(--transition);
}

.ttp-option:hover:not(.disabled) {
  border-color: var(--clr-accent);
  transform: translateX(4px);
}

.ttp-option:hover:not(.disabled)::before {
  background: rgba(23, 51, 231, 0.06);
}

.ttp-option.disabled {
  cursor: default;
}

.ttp-option-key {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: var(--clr-border);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--clr-muted);
  transition: all var(--transition);
}

.ttp-option-text {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Correct/Wrong states */
.ttp-option.correct {
  border-color: var(--clr-green) !important;
  background: var(--clr-green-bg) !important;
}

.ttp-option.correct .ttp-option-key {
  background: var(--clr-green);
  color: #fff;
}

.ttp-option.wrong {
  border-color: var(--clr-red) !important;
  background: var(--clr-red-bg) !important;
}

.ttp-option.wrong .ttp-option-key {
  background: var(--clr-red);
  color: #fff;
}

/* ── FEEDBACK ──────────────────────────────────────────────── */
.ttp-feedback {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: ttpFadeIn 0.3s ease;
}

.ttp-feedback.correct {
  background: var(--clr-green-bg);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--clr-green);
}

.ttp-feedback.wrong {
  background: var(--clr-red-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--clr-red);
}

.ttp-feedback.hidden {
  display: none;
}

/* ── RESULT SCREEN ─────────────────────────────────────────── */
.ttp-result-wrap {
  padding: 40px 0;
  text-align: center;
}

.ttp-result-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: ttpBounce 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes ttpBounce {

  0%,
  100% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.3);
  }

  60% {
    transform: scale(0.9);
  }
}

.ttp-result-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.ttp-result-name {
  color: var(--clr-muted);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 28px;
}

.ttp-score-cards {
  display: grid;
  gap: 14px;
  margin-bottom: 32px;
}

.ttp-score-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.ttp-score-card-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--clr-muted);
  margin-bottom: 4px;
}

.ttp-score-card-value {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.ttp-score-card.pre .ttp-score-card-value {
  color: var(--clr-accent);
}

.ttp-score-card.post .ttp-score-card-value {
  color: var(--clr-green);
}

.ttp-score-card.diff .ttp-score-card-value {
  color: var(--clr-gold);
}

.ttp-score-card-icon {
  font-size: 32px;
}

.ttp-result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── RANKING ───────────────────────────────────────────────── */
.ttp-ranking-header {
  text-align: center;
  padding: 32px 0 24px;
}

.ttp-ranking-header h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}

.ttp-ranking-header p {
  color: var(--clr-muted);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ttp-ranking-table-wrap {
  overflow-x: auto !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--clr-border) !important;
  background: var(--clr-surface) !important;
  box-shadow: none !important;
}

.ttp-ranking-table {
  width: 100% !important;
  border-collapse: collapse !important;
  box-shadow: none !important;
  border: none !important;
  outline: none !important;
}

.ttp-ranking-table thead,
.ttp-ranking-table tbody,
.ttp-ranking-table tr {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.ttp-ranking-table th {
  padding: 14px 16px !important;
  text-align: left !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  color: var(--clr-muted) !important;
  border-bottom: 1px solid var(--clr-border) !important;
  white-space: nowrap !important;
  background: transparent !important;
}

.ttp-ranking-table td {
  padding: 14px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-bottom: 1px solid rgba(23, 51, 231, 0.08) !important;
  white-space: nowrap !important;
  background: transparent !important;
}

.ttp-ranking-table tr:last-child td {
  border-bottom: none !important;
}

.ttp-ranking-table tr:hover td {
  background: rgba(23, 51, 231, 0.04) !important;
}

/* Rank column */
.rank-cell {
  font-family: var(--font-mono) !important;
  font-weight: 700 !important;
  font-size: 16px !important;
}

.rank-1 {
  color: var(--clr-gold) !important;
}

.rank-2 {
  color: var(--clr-silver) !important;
}

.rank-3 {
  color: var(--clr-bronze) !important;
}

.rank-medal {
  font-size: 20px !important;
}

.score-cell {
  font-family: var(--font-mono) !important;
  font-weight: 700 !important;
  font-size: 16px !important;
}

.score-pre {
  color: var(--clr-accent) !important;
}

.score-post {
  color: var(--clr-green) !important;
}

.score-diff {
  font-size: 13px !important;
  font-weight: 600 !important;
}

.score-diff.pos {
  color: var(--clr-green) !important;
}

.score-diff.neg {
  color: var(--clr-red) !important;
}

.score-diff.neu {
  color: var(--clr-muted) !important;
}

.ttp-ranking-empty {
  padding: 40px !important;
  text-align: center !important;
  color: var(--clr-muted) !important;
  font-size: 14px !important;
}

/* ── LOADING ───────────────────────────────────────────────── */
.ttp-loading {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
}

.ttp-loading.hidden {
  display: none;
}

.ttp-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--clr-border);
  border-top-color: var(--clr-accent);
  border-radius: 50%;
  animation: ttpSpin 0.8s linear infinite;
}

.ttp-loading p {
  font-size: 14px;
  color: var(--clr-muted);
  font-weight: 500;
}

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

/* ── STATUS TAGS ───────────────────────────────────────────── */
.ttp-status-done {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--clr-green-bg);
  color: var(--clr-green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* ── MOBILE ────────────────────────────────────────────────── */
@media (min-width: 480px) {
  .ttp-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ttp-btn-group .ttp-btn-rank {
    grid-column: 1 / -1;
  }

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

  .ttp-score-cards .ttp-score-card:last-child:nth-child(3) {
    grid-column: 1 / -1;
  }

  .ttp-result-actions {
    flex-direction: row;
    justify-content: center;
  }

  .ttp-result-actions .ttp-btn {
    width: auto;
    flex: 1;
    max-width: 220px;
  }
}