/* ==========================================================================
   CISSP PRACTICE HUB - DARK LUXURY CYBERSECURITY DESIGN SYSTEM
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: #151c2c;
  --bg-card-hover: #1c263b;
  --bg-elevated: #212c45;
  
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-gold: #eab308;
  --color-gold-hover: #ca8a04;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(59, 130, 246, 0.5);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-sans: 'Noto Sans TC', 'Outfit', -apple-system, sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-gold: 0 0 20px rgba(234, 179, 8, 0.25);
  --shadow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(234, 179, 8, 0.04) 0%, transparent 40%);
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: rgba(21, 28, 44, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-blue);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-title span {
  color: var(--color-gold);
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

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

.nav-btn.active {
  color: var(--color-gold);
  background: rgba(234, 179, 8, 0.1);
  border-color: rgba(234, 179, 8, 0.3);
}

.nav-btn.icon-only {
  padding: 8px 12px;
}

.badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 700;
}

/* Main Content Views */
.main-content {
  padding-top: 30px;
  padding-bottom: 60px;
}

.view-panel {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-panel.active {
  display: block;
}

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

/* Card Component */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.card-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.card-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Setup View Layout */
.setup-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.form-select, .form-input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-select:focus, .form-input:focus {
  border-color: var(--color-primary);
}

.pill-options {
  display: flex;
  gap: 10px;
}

.pill-btn {
  flex: 1;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.pill-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.mode-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.mode-card.active {
  border-color: var(--color-gold);
  background: rgba(234, 179, 8, 0.05);
}

.mode-card input {
  margin-top: 4px;
}

.mode-card strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
}

.mode-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stats Overview Column */
.stats-overview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-icon.gold { background: rgba(234, 179, 8, 0.15); color: var(--color-gold); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--color-primary); }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }

.stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); }
.stat-val { font-size: 1.3rem; font-weight: 800; color: var(--text-main); }

/* Quiz Room View */
.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.quiz-progress-text {
  font-size: 0.95rem;
}

.domain-pill {
  background: var(--bg-elevated);
  color: var(--color-gold);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  margin-left: 10px;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.quiz-actions-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--color-primary);
}

.icon-btn.active {
  color: var(--color-gold);
  border-color: var(--color-gold);
}

.timer-box {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;

}

.quiz-progress-bar {
  height: 6px;
  background: var(--bg-main);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 24px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  transition: width 0.3s ease;
}

.question-box {
  margin-bottom: 24px;
}

.question-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--text-main);
}

.question-en {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 10px;
  padding: 12px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-primary);
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.option-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-align: left;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.option-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateX(4px);
}

.option-btn .opt-key {
  background: var(--bg-elevated);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.option-btn.selected {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.1);
}

.option-btn.correct {
  border-color: var(--color-success) !important;
  background: rgba(16, 185, 129, 0.15) !important;
  color: #fff !important;
}

.option-btn.correct .opt-key {
  background: var(--color-success);
  color: #fff;
}

.option-btn.wrong {
  border-color: var(--color-danger) !important;
  background: rgba(239, 68, 68, 0.15) !important;
}

.option-btn.wrong .opt-key {
  background: var(--color-danger);
  color: #fff;
}

/* Explanation Box */
.explanation-box {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  border-left: 4px solid var(--color-gold);
  animation: fadeIn 0.3s ease;
}

.exp-header {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exp-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Quiz Footer */
.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }

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

.btn-success { background: var(--color-success); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: rgba(255, 255, 255, 0.05); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* Result Card */
.score-display {
  margin: 20px 0;
}

.score-num {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--color-gold);
  font-family: var(--font-mono);
}

.result-badge-icon {
  font-size: 3.5rem;
  margin-bottom: 8px;
}

.result-breakdown-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin: 24px 0;
  background: var(--bg-main);
  padding: 16px;
  border-radius: var(--radius-sm);
}

.result-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  position: relative;
}

.modal-md { max-width: 500px; width: 90%; }

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--color-gold);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

/* Utilities */
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

@media (max-width: 768px) {
  .setup-grid { grid-template-columns: 1fr; }
  .mode-cards-grid { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
}
