/* ============================================================
 *  prediction.css — Prediction/Quiz UI styles
 *  Colors use runtime theme variables set by applyRuntimeTheme()
 * ============================================================ */

/* Theme variable scope for this modal */
.prediction-modal {
  --text-muted: rgba(var(--runtime-primary-rgb, 9,216,255), 0.65);
}
.prediction-modal .modal-card {
  background: linear-gradient(180deg,
    rgba(var(--runtime-bg-rgb, 13,41,82), 0.97),
    rgba(var(--runtime-bg-rgb, 3,16,32), 1)
  );
  border-color: rgba(var(--runtime-primary-rgb, 0,180,255), 0.3);
}

/* ---------- Loading ---------- */
.pred-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted, #9ebce5);
}
.pred-loading i { font-size: 32px; margin-bottom: 12px; display: block; }

/* ---------- List ---------- */
.pred-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px;
}

.pred-card {
  background: rgba(var(--runtime-bg-rgb, 13,30,60), .85);
  border: 1px solid rgba(var(--runtime-primary-rgb, 0,180,255), 0.2);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pred-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--runtime-primary-rgb, 0,180,255), 0.15);
}

.pred-card-img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: rgba(0,0,0,0.2);
  display: block;
}

.pred-card-body { padding: 14px 16px; }

.pred-card-title {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  margin-bottom: 8px;
}

.pred-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted, #9ebce5);
  margin-bottom: 10px;
}
.pred-card-meta i { margin-right: 4px; }

.pred-card-status {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
}
.pred-card-status.submitted {
  background: rgba(0,200,150,0.15);
  color: #4dd8a8;
}
.pred-card-status.pending {
  background: rgba(var(--runtime-accent-rgb, 255,200,50), 0.15);
  color: var(--gold, #f4d787);
}
.pred-card-status.wrong {
  background: rgba(255,100,100,0.15);
  color: #ff7c7c;
}

/* ---------- Reward badge ---------- */
.pred-reward-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(var(--runtime-accent-rgb, 255,200,50), 0.18);
  color: var(--gold, #f4d787);
  border-radius: 6px;
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- Detail ---------- */
.pred-detail { padding: 8px; }

.pred-back {
  background: transparent;
  border: none;
  color: var(--text-muted, #9ebce5);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
  padding: 4px 0;
}
.pred-back:hover { color: #fff; }

.pred-detail-img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 16px;
  background: rgba(0,0,0,0.15);
  display: block;
}

.pred-detail-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
}

.pred-detail-desc {
  font-size: 14px;
  color: var(--text-muted, #9ebce5);
  background: rgba(var(--runtime-bg-rgb, 0,40,80), 0.4);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.pred-detail-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #9ebce5);
  margin-bottom: 10px;
}

/* ---------- Eligibility Warning ---------- */
.pred-eligibility-warn {
  background: rgba(255,160,0,.12);
  border: 1px solid rgba(255,160,0,.3);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--gold, #f4d787);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.pred-eligibility-warn i { font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.pred-elig-sub { opacity: .75; margin-top: 3px; font-size: 12px; }

/* ---------- Text answer input ---------- */
.pred-text-input {
  width: 100%;
  background: rgba(var(--runtime-bg-rgb, 0,20,50), 0.6);
  border: 2px solid rgba(var(--runtime-primary-rgb, 0,180,255), 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  color: #fff;
  font-size: 15px;
  box-sizing: border-box;
  margin-bottom: 14px;
  outline: none;
}
.pred-text-input:focus {
  border-color: var(--sky, #09d8ff);
}
.pred-text-input::placeholder { opacity: .4; }

.pred-text-answer {
  background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.1);
  border: 1px solid rgba(var(--runtime-primary-rgb, 0,180,255), 0.25);
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  font-size: 15px;
  margin-bottom: 14px;
}

/* ---------- Choices ---------- */
.pred-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.pred-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(var(--runtime-bg-rgb, 13,30,60), 0.8);
  border: 2px solid rgba(var(--runtime-primary-rgb, 0,180,255), 0.2);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  color: #fff;
  font-size: 15px;
}
.pred-choice:hover:not(.disabled) {
  border-color: rgba(var(--runtime-primary-rgb, 0,180,255), 0.5);
  background: rgba(var(--runtime-primary-rgb, 0,100,150), 0.2);
}
.pred-choice.selected {
  border-color: var(--sky, #09d8ff);
  background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.2);
}
.pred-choice.disabled { cursor: default; opacity: 0.8; }
.pred-choice.correct {
  border-color: #4dd8a8;
  background: rgba(0,200,150,0.15);
}
.pred-choice.wrong {
  border-color: #ff7c7c;
  background: rgba(255,100,100,0.15);
}

.pred-choice-num {
  width: 28px;
  height: 28px;
  background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.pred-choice.selected .pred-choice-num {
  background: var(--sky, #09d8ff);
  color: #fff;
}
.pred-choice.correct .pred-choice-num { background: #4dd8a8; }
.pred-choice.wrong   .pred-choice-num { background: #ff7c7c; }

.pred-choice-text { flex: 1; }

.pred-choice-icon { font-size: 18px; margin-left: auto; }
.pred-choice-icon.correct { color: #4dd8a8; }
.pred-choice-icon.wrong   { color: #ff7c7c; }

/* ---------- Result ---------- */
.pred-result {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pred-result.correct {
  background: linear-gradient(135deg, rgba(0,200,150,0.2), rgba(0,150,100,0.1));
  color: #4dd8a8;
  border: 1px solid rgba(0,200,150,0.3);
}
.pred-result.wrong {
  background: linear-gradient(135deg, rgba(255,100,100,0.2), rgba(200,50,50,0.1));
  color: #ff7c7c;
  border: 1px solid rgba(255,100,100,0.3);
}
.pred-result.pending {
  background: rgba(var(--runtime-accent-rgb, 255,200,50), 0.15);
  color: var(--gold, #f4d787);
  border: 1px solid rgba(var(--runtime-accent-rgb, 255,200,50), 0.3);
}
.pred-result.info {
  background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.15);
  color: var(--sky, #09d8ff);
  border: 1px solid rgba(var(--runtime-primary-rgb, 0,180,255), 0.3);
}
.pred-result.reward {
  background: rgba(var(--runtime-accent-rgb, 255,200,50), 0.18);
  color: var(--gold, #f4d787);
  border: 1px solid rgba(var(--runtime-accent-rgb, 255,200,50), 0.35);
}
.pred-result i { font-size: 20px; }

/* ---------- Submit Button ---------- */
.pred-submit-btn {
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--sky, #09d8ff), rgba(var(--runtime-primary-rgb, 0,136,204), .8));
  color: #fff;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.pred-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--runtime-primary-rgb, 0,180,255), 0.3);
}
.pred-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Popup ---------- */
.pred-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: predFadeIn 0.3s ease;
}
@keyframes predFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pred-popup-box {
  background: rgba(var(--runtime-bg-rgb, 13,30,60), .95);
  border: 1px solid rgba(var(--runtime-primary-rgb, 0,180,255), 0.3);
  border-radius: 20px;
  max-width: 360px;
  width: 100%;
  overflow: hidden;
  position: relative;
  animation: predSlideUp 0.3s ease;
}
@keyframes predSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.pred-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  z-index: 1;
}

.pred-popup-img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: rgba(0,0,0,0.15);
  display: block;
}

.pred-popup-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  padding: 16px 20px 8px;
  text-align: center;
}

.pred-popup-desc {
  font-size: 13px;
  color: var(--text-muted, #9ebce5);
  padding: 0 20px 16px;
  text-align: center;
}

.pred-popup-btn {
  width: calc(100% - 40px);
  margin: 0 20px 20px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold, #f4d787), rgba(var(--runtime-accent-rgb, 244,149,0), .9));
  color: #1a1a2e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s;
}
.pred-popup-btn:hover { transform: scale(1.02); }

/* ---------- Tabs ---------- */
.pred-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
}
.pred-tab {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(var(--runtime-bg-rgb, 13,30,60), .6);
  color: var(--text-muted, #9ebce5);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pred-tab:hover {
  background: rgba(var(--runtime-bg-rgb, 13,30,60), .9);
  color: #fff;
}
.pred-tab.active {
  background: linear-gradient(135deg, var(--sky, #09d8ff), rgba(var(--runtime-primary-rgb, 0,136,204), .8));
  color: #fff;
}

/* ---------- History Card ---------- */
.pred-history-card .pred-card-body { padding: 12px 16px; }
.pred-history-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.1);
  border-radius: 8px;
  margin-bottom: 8px;
}
.pred-history-choice.correct { background: rgba(0,200,150,0.1); }
.pred-history-choice.reward  { background: rgba(var(--runtime-accent-rgb,255,200,50),0.1); }
.pred-history-label { color: var(--text-muted, #9ebce5); }
.pred-history-value { color: #fff; font-weight: 600; }
.pred-history-choice.correct .pred-history-value { color: #4dd8a8; }

/* ---------- History Table ---------- */
.pred-hist-wrap {
  overflow-x: auto;
  padding: 8px;
}
.pred-hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 480px;
}
.pred-hist-table thead tr {
  background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.1);
}
.pred-hist-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted, #9ebce5);
  border-bottom: 1px solid rgba(var(--runtime-primary-rgb, 0,180,255), 0.15);
  white-space: nowrap;
}
.pred-hist-row {
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: background .15s;
}
.pred-hist-row:hover { background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.06); }
.pred-hist-table td {
  padding: 10px 12px;
  vertical-align: middle;
  color: #e8f4ff;
}

/* รูปภาพ */
.pred-hist-img-cell { width: 56px; padding: 8px 10px; }
.pred-hist-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.pred-hist-img-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(var(--runtime-primary-rgb, 0,180,255), 0.1);
  display: grid;
  place-items: center;
  color: var(--text-muted, #9ebce5);
  font-size: 20px;
}

/* ชื่อกิจกรรม */
.pred-hist-title {
  font-weight: 600;
  max-width: 150px;
  word-break: break-word;
  line-height: 1.4;
}

/* คำตอบถูก */
.pred-hist-correct-ans { color: #4dd8a8; font-weight: 600; }

/* ผล */
.pred-hist-win  { color: #4dd8a8; font-weight: 700; }
.pred-hist-lose { color: #ff7c7c; font-weight: 700; }
.pred-hist-wait { color: var(--gold, #f4d787); font-weight: 600; }

/* รางวัล */
.pred-hist-reward {
  font-size: 11px;
  color: var(--gold, #f4d787);
  margin-top: 3px;
}

/* เวลา */
.pred-hist-time {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted, #9ebce5);
}
.pred-hist-time small { opacity: .7; }
