/* ==========================================================================
   DESIGN SYSTEM & CUSTOM PROPERTIES
   ========================================================================== */
:root {
  /* HSL Color Palette (Premium Dark Theme) */
  --bg-main: #0b141a;
  --bg-sidebar: #111b21;
  --bg-card: #202c33;
  --bg-input: #2a3942;
  
  --primary: #00a884; /* WhatsApp Emerald Green */
  --primary-hover: #008f70;
  --primary-light: rgba(0, 168, 132, 0.15);
  
  --text-main: #e9edef;
  --text-muted: #8696a0;
  --text-light: #ffffff;
  
  --border-color: #222e35;
  --border-focus: #00a884;
  
  /* Status Colors */
  --color-danger: #f15c5c;
  --color-warning: #ffd043;
  --color-info: #53bdeb;
  --color-success: #00e676;
  
  /* Fonts */
  --font-header: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  /* Spacing */
  --sidebar-width: 320px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  /* Transitions */
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.35);
  
  /* Font size base */
  --reader-font-size: 1.1rem;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #eaebeb;
  
  --primary: #008069;
  --primary-hover: #006b57;
  --primary-light: rgba(0, 128, 105, 0.1);
  
  --text-main: #111b21;
  --text-muted: #667781;
  --text-light: #111b21;
  
  --border-color: #e1e3e6;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   RESET & GLOBAL STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
  font-weight: 700;
  line-height: 1.2;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform var(--transition-normal), background-color var(--transition-normal);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2.2rem;
}

.logo-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.close-sidebar-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.sidebar-nav {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--primary);
  color: var(--text-light);
}

.nav-icon {
  font-size: 1.2rem;
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 12px 24px;
}

/* Chapter Navigation Section */
.chapters-nav-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 24px;
  overflow-y: auto;
}

/* Hide chapters list when not in reader mode (handled in JS) */
.chapters-nav-container.hidden {
  display: none;
}

.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px;
  padding-right: 40px;
  background-color: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.chapters-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.chapter-link:hover {
  background-color: var(--bg-input);
  color: var(--text-main);
  padding-left: 16px;
}

.chapter-link.active {
  background-color: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-footer {
  padding: 24px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
}

.author-tag {
  font-weight: 600;
  margin-top: 4px;
  color: var(--primary);
}

.learning-progress {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.learning-progress strong {
  color: var(--primary);
  text-align: right;
}

.independent-notice {
  margin-top: 10px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header Top Bar */
.top-bar {
  height: var(--header-height);
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-main);
  margin-right: 16px;
}

.current-section-info {
  display: flex;
  flex-direction: column;
}

.section-label {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
}

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

/* Resizer and toggles */
.text-resizer {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.resize-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.resize-btn:hover {
  background-color: var(--bg-input);
}

.resize-btn:first-child {
  border-right: 1px solid var(--border-color);
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: var(--bg-input);
}

.install-btn {
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--primary);
  padding: 7px 12px;
  font-weight: 700;
  cursor: pointer;
}

.install-btn:hover {
  background: rgba(0, 168, 132, 0.12);
}

/* Dynamic Tab Contents */
.tab-wrapper {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.tab-content {
  display: none;
  padding: 40px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   TAB MODULES: EBOOK READER
   ========================================================================== */
.reader-container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.reader-progress-bar-container {
  position: sticky;
  top: 0;
  width: 100%;
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 30px;
}

.reader-progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--primary);
  transition: width 0.1s linear;
}

/* Reader Typography */
.reader-body {
  font-size: var(--reader-font-size);
  line-height: 1.8;
  transition: font-size 0.2s ease;
}

.reader-body p {
  margin-bottom: 24px;
}

.reader-body h3 {
  margin-top: 40px;
  margin-bottom: 16px;
  font-size: 1.6rem;
  color: var(--text-light);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.reader-body ul, .reader-body ol {
  margin-left: 24px;
  margin-bottom: 24px;
}

.reader-body li {
  margin-bottom: 10px;
}

/* Dialogue style */
.reader-body p.dialogue {
  background-color: var(--primary-light);
  color: var(--primary);
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  font-weight: 500;
}

/* Boxes within the reader */
.warning-box {
  background-color: rgba(241, 92, 92, 0.08);
  border-left: 4px solid var(--color-danger);
  padding: 20px;
  border-radius: var(--radius-sm);
  margin: 30px 0;
}

.warning-box strong {
  color: var(--color-danger);
  display: block;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.tip-box {
  background-color: rgba(255, 208, 67, 0.08);
  border-left: 4px solid var(--color-warning);
  padding: 20px;
  border-radius: var(--radius-sm);
  margin: 30px 0;
}

.tip-box strong {
  color: var(--color-warning);
  display: block;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.info-box {
  background-color: rgba(83, 189, 235, 0.08);
  border-left: 4px solid var(--color-info);
  padding: 20px;
  border-radius: var(--radius-sm);
  margin: 30px 0;
}

.info-box strong {
  color: var(--color-info);
  display: block;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

/* Navigation buttons */
.reader-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 50px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.nav-prev-btn, .nav-next-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-prev-btn:hover:not(:disabled), .nav-next-btn:hover:not(:disabled) {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--text-light);
}

.nav-prev-btn:disabled, .nav-next-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   TAB MODULES: CHAT SIMULATOR
   ========================================================================== */
.simulator-container {
  max-width: 600px;
  margin: 0 auto;
  height: calc(100vh - var(--header-height) - 80px);
  display: flex;
  flex-direction: column;
}

.intro-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.intro-card h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  text-align: center;
}

.intro-card p {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

.scenario-selector-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scenario-select-btn {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-normal);
}

.scenario-select-btn:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.scenario-select-btn .btn-icon {
  font-size: 1.8rem;
  grid-row: 1 / 3;
}

.scenario-select-btn strong {
  font-size: 1.05rem;
  color: var(--text-light);
}

.scenario-select-btn span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Chat Screen Mockup */
.chat-interface {
  background-color: #0b141a; /* Dark green/black WhatsApp BG */
  background-image: radial-gradient(rgba(0, 168, 132, 0.05) 1px, transparent 0);
  background-size: 24px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.chat-header {
  height: 60px;
  background-color: var(--bg-sidebar);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.chat-back-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.chat-contact-avatar {
  width: 40px;
  height: 40px;
  background-color: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 1px solid var(--border-color);
}

.chat-contact-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-contact-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-light);
}

.chat-contact-status {
  font-size: 0.75rem;
  color: var(--primary);
}

.chat-header-actions {
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  gap: 16px;
}

.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Chat bubble styling */
.message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  animation: bubbleEntry 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

@keyframes bubbleEntry {
  0% { opacity: 0; transform: translateY(10px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.message-bubble.them {
  background-color: var(--bg-card);
  align-self: flex-start;
  border-top-left-radius: 0;
  color: var(--text-main);
}

.message-bubble.user {
  background-color: #005c4b; /* WhatsApp user dark green bubble */
  color: var(--text-light);
  align-self: flex-end;
  border-top-right-radius: 0;
}

.message-bubble.system {
  background-color: #182229;
  color: #ffd043;
  align-self: center;
  max-width: 90%;
  font-size: 0.85rem;
  text-align: center;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  border: 1px solid rgba(255, 208, 67, 0.2);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background-color: var(--bg-card);
  align-self: flex-start;
  border-radius: var(--radius-md);
  border-top-left-radius: 0;
  animation: fadeIn 0.2s ease;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Panel & Choices */
.chat-options-panel {
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.options-panel-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.option-btn:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
  transform: translateX(4px);
}

/* Outcome screen */
.chat-outcome-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(11, 20, 26, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
  animation: fadeIn 0.3s ease;
}

.outcome-card {
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.outcome-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.outcome-title {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-light);
}

.outcome-desc {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* General button */
.action-btn {
  background-color: var(--primary);
  color: var(--text-light);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.action-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.action-btn.secondary {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.action-btn.secondary:hover {
  background-color: var(--bg-input);
}

/* ==========================================================================
   TAB MODULES: RED FLAGS ANALYZER
   ========================================================================== */
.analyzer-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  max-width: 700px;
  margin: 0 auto;
}

.analyzer-card p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.analyzer-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.analyzer-selector select {
  padding: 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.analyzer-selector select:focus {
  border-color: var(--primary);
}

/* Phone Mockup */
.phone-mockup-wrapper {
  background-color: var(--bg-main);
  border: 4px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin: 30px auto;
  max-width: 480px;
  box-shadow: var(--shadow-sm);
}

.phone-mockup-screen {
  background-color: #0b141a;
  background-image: radial-gradient(rgba(0, 168, 132, 0.03) 1px, transparent 0);
  background-size: 20px 20px;
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-chat-bubble {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border-top-left-radius: 0;
  padding: 14px;
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 90%;
  box-shadow: var(--shadow-sm);
}

/* Highlights */
.flag-hl {
  background-color: rgba(255, 208, 67, 0.25);
  border-bottom: 2px dashed var(--color-warning);
  color: var(--color-warning);
  padding: 0 4px;
  cursor: pointer;
  font-weight: 600;
  border-radius: 2px;
  transition: var(--transition-fast);
  display: inline-block;
  margin: 2px 0;
}

.flag-hl:hover, .flag-hl.active {
  background-color: rgba(255, 208, 67, 0.45);
  border-bottom-style: solid;
}

/* Explanation display */
.explanation-box {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 100px;
  transition: var(--transition-normal);
}

.explanation-placeholder {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  font-size: 0.95rem;
}

.explanation-title {
  color: var(--color-warning);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.explanation-desc {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* ==========================================================================
   TAB MODULES: QUIZ & CERTIFICATE
   ========================================================================== */
.quiz-container {
  max-width: 650px;
  margin: 0 auto;
}

.text-center {
  text-align: center;
}

.huge-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 20px;
}

/* Quiz Panel */
.quiz-header-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.quiz-progress-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.quiz-progress-track {
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 10%;
  background-color: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.quiz-score-live {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.quiz-question-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.quiz-question-box h4 {
  font-size: 1.25rem;
  margin-bottom: 24px;
  color: var(--text-light);
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.quiz-option-container:hover {
  border-color: var(--text-muted);
}

.quiz-option-container input {
  cursor: pointer;
}

.quiz-option-text {
  font-size: 0.95rem;
  font-weight: 500;
}

/* Correct/Incorrect State */
.quiz-option-container.correct {
  background-color: rgba(0, 230, 118, 0.08);
  border-color: var(--color-success);
  color: var(--color-success);
  font-weight: 600;
}

.quiz-option-container.incorrect {
  background-color: rgba(241, 92, 92, 0.08);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* Feedback panel */
.quiz-feedback-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  animation: slideUp 0.3s ease;
}

.feedback-indicator {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.feedback-indicator.correct {
  color: var(--color-success);
}

.feedback-indicator.incorrect {
  color: var(--color-danger);
}

.feedback-explanation {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Results panel */
.results-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.results-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.results-score {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

.results-message {
  color: var(--text-muted);
  margin-bottom: 30px;
  max-width: 450px;
}

/* ==========================================================================
   CERTIFICATE STYLE
   ========================================================================== */
.certificate-container {
  width: 100%;
  margin-bottom: 30px;
  animation: fadeIn 0.5s ease;
}

.certificate-frame {
  border: 8px double #c5a059; /* Double Gold Border */
  background-color: #fdfdfd;
  color: #111b21;
  padding: 40px;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(197, 160, 89, 0.03) 10%, transparent 80%),
    linear-gradient(#fbf8f2, #fbf8f2);
  margin-bottom: 24px;
  text-align: center;
  position: relative;
}

/* Decorative corner elements */
.certificate-frame::before {
  content: "";
  position: absolute;
  top: 10px; left: 10px; right: 10px; bottom: 10px;
  border: 1px solid rgba(197, 160, 89, 0.4);
  pointer-events: none;
}

.cert-badge {
  font-size: 3rem;
  display: inline-block;
  margin-bottom: 16px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.certificate-body h2 {
  font-family: var(--font-header);
  font-size: 1.8rem;
  font-weight: 800;
  color: #8c6d31; /* Golden tone */
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.cert-text {
  font-size: 0.95rem;
  font-style: italic;
  margin-bottom: 12px;
}

.cert-name-input-box {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 16px auto;
}

.cert-name-input-box input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #c5a059;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: #111b21;
  font-size: 0.95rem;
  outline: none;
}

.cert-confirm-btn {
  background-color: #8c6d31;
  color: #ffffff;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.cert-confirm-btn:hover {
  background-color: #6d5423;
}

.cert-recipient-name {
  font-family: var(--font-header);
  font-size: 1.8rem;
  font-weight: 700;
  color: #111b21;
  border-bottom: 2px solid #c5a059;
  display: inline-block;
  padding: 4px 30px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.cert-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto 30px;
  color: #4a5568;
}

.cert-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  max-width: 480px;
  margin: 0 auto;
}

.cert-signature {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sig-line {
  border-top: 1px solid #a0aec0;
  width: 100%;
  padding-top: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #2d3748;
}

.sig-title {
  font-size: 0.75rem;
  color: #718096;
}

.print-btn {
  background-color: #8c6d31;
}
.print-btn:hover {
  background-color: #6d5423;
}

.certificate-disclaimer,
.version-note {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.checklist-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  margin: 18px 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-sidebar);
}

.checklist-card label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.checklist-card input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--primary);
}

.emergency-steps li {
  margin-bottom: 12px;
}

/* ==========================================================================
   UTILITY & ANIMATION CLASSES
   ========================================================================== */
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

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

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 992px) {
  /* Sidebar toggle active style */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .close-sidebar-btn {
    display: block;
  }
  
  .menu-toggle-btn {
    display: block;
  }
  
  .top-bar {
    padding: 0 20px;
  }
}

@media (max-width: 768px) {
  .tab-content {
    padding: 20px;
  }
  
  .top-bar {
    height: auto;
    min-height: 104px;
    flex-wrap: wrap;
    padding: 10px 16px;
    row-gap: 8px;
    flex-shrink: 0;
  }
  
  .current-section-info {
    order: 3;
    width: 100%;
    margin-top: 0;
    min-width: 0;
  }

  .section-title {
    font-size: 1.05rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .header-controls {
    order: 2;
  }
  
  .cert-footer {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .cert-name-input-box {
    flex-direction: column;
  }

  .certificate-frame {
    padding: 30px 18px;
    border-width: 5px;
  }

  .certificate-body h2 {
    font-size: 1.35rem;
  }

  .cert-name-input-box input,
  .cert-confirm-btn {
    width: 100%;
  }
}

/* ==========================================================================
   BOOK COVER STYLE
   ========================================================================== */
.cover-container {
  text-align: center;
  margin-bottom: 35px;
  width: 100%;
}

.book-cover {
  max-width: 100%;
  height: auto;
  max-height: 480px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-normal);
}

.book-cover:hover {
  transform: scale(1.02);
}

/* ==========================================================================
   PRINT MEDIA STYLES
   ========================================================================== */
@media print {
  body * {
    visibility: hidden;
  }
  .certificate-container, .certificate-container * {
    visibility: visible;
  }
  .certificate-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  .print-btn, .quiz-results-panel button {
    display: none !important;
  }
  .certificate-frame {
    border: 6px double #8c6d31 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
}
