:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --page: #f8fafc;
  --card-bg: #ffffff;
  --radius: 16px;
  --radius-lg: 24px;
  --transition: 0.25s ease;
  --success: #10b981;
  --success-light: #34d399;
  --success-dark: #059669;
  --text-dark: #1e293b;
  --text-medium: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* Reset & base */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-medium);
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field { position: relative; margin-bottom: 14px; }

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-light);
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover { color: var(--primary); }

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error { color: #dc2626; }
.success { color: #16a34a; }

/* ---------- Logout button ---------- */
.logout-icon {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: white;
  color: var(--text-medium);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  z-index: 1000;
}
.logout-icon i {
  font-size: 16px;
  line-height: 1;
}

.logout-icon:hover { 
  background: var(--primary);
  color: white;
}
.logout-icon:active { transform: translateY(1px); }

/* ========================================
   MAIN APP STYLES
   ======================================== */

#mainApp {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  animation: fade-in 0.45s ease both;
}

.app-header {
  text-align: center;
  margin-bottom: 30px;
}

.app-header h1 {
  font-size: 1.8rem;
  color: var(--text-dark);
  margin: 0;
  font-weight: 700;
}

.app-header h1 i {
  margin-right: 10px;
  color: var(--primary);
}

/* ---------- Input Section ---------- */
.input-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

.input-wrapper {
  margin-bottom: 16px;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #f9fafb;
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: all var(--transition);
}

.input-wrapper input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* ---------- Dual Textarea Layout ---------- */
.dual-textarea-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.textarea-column {
  display: flex;
  flex-direction: column;
}

.column-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.column-label.answer-label-header {
  background: #ecfdf5;
}

.column-label i {
  color: var(--primary);
  font-size: 1.1rem;
}

.column-label.answer-label-header i {
  color: var(--success);
}

/* ========================================
   FORMATTED EDITOR STYLES
   ======================================== */

.formatted-editor {
  width: 100%;
  min-height: 550px;
  max-height: 700px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fafbfc;
  font-size: 0.95rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  outline: none;
  overflow-y: auto;
  transition: all var(--transition);
  flex: 1;
}

.formatted-editor:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.formatted-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-light);
  pointer-events: none;
}

/* Question Block Styling */
.q-block {
  display: block;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 9px 0;
  position: relative;
}

.q-block:first-child {
  margin-top: 0;
}

/* Answer Block Styling */
.a-block {
  display: block;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 9px 0;
  position: relative;
}

.a-block:first-child {
  margin-top: 0;
}

/* Tag styling */
.q-tag {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

.a-tag {
  display: inline-block;
  background: var(--success);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

/* Content inside blocks */
.block-content {
  display: inline;
  color: var(--text-dark);
}

/* Unformatted text (between blocks) */
.unformatted-text {
  color: var(--text-medium);
  font-style: italic;
}

/* Hidden textarea for actual data */
.hidden-textarea {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Editor toolbar hint */
.editor-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-hint i {
  font-size: 0.9rem;
}

/* Question counter badge */
.question-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: auto;
}

.question-counter.answer-counter {
  background: var(--success);
}

/* ---------- Send Wrapper ---------- */
.send-wrapper {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

/* ---------- Send Button ---------- */
.send-btn {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--success);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
}

.send-btn:hover {
  background: var(--success-dark);
  transform: translateY(-1px);
}

.send-btn:active {
  transform: translateY(0);
}

.send-btn:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
}

.send-btn i {
  font-size: 0.9rem;
}

/* ---------- Links Section ---------- */
.links-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  animation: fade-in 0.45s ease both;
  border: 1px solid var(--border);
}

.links-section h2 {
  font-size: 1.2rem;
  color: var(--text-dark);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.links-section h2 i {
  color: var(--primary);
}

/* ---------- Link Item ---------- */
.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f9fafb;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.link-item:hover {
  border-color: var(--primary-light);
  background: #fff;
}

.link-item:last-child {
  margin-bottom: 0;
}

.link-info {
  flex: 1;
}

.link-title {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.link-meta {
  font-size: 0.85rem;
  color: var(--text-medium);
}

.link-actions {
  display: flex;
  gap: 8px;
}

.link-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.link-btn.view {
  background: var(--primary);
  color: #fff;
}

.link-btn.view:hover {
  background: var(--primary-dark);
}

.link-btn.copy {
  background: var(--border);
  color: var(--text-dark);
}

.link-btn.copy:hover {
  background: #d1d5db;
}

/* ========================================
   VIEW TEST PAGE STYLES - CLEAN LIGHT DESIGN
   ======================================== */

#viewTestPage {
  width: 100%;
  min-height: 100vh;
  padding: 0;
  background: linear-gradient(180deg, #f1f5f9 0%, var(--page) 100%);
}

.test-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  animation: fade-in 0.45s ease both;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Clean Test Header */
.test-header {
  text-align: center;
  margin-bottom: 32px;
  padding: 0;
  background: transparent;
}

.test-header h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 20px 0;
  font-weight: 800;
  letter-spacing: -0.5px;
  padding: 12px 32px;
  position: relative;
  display: inline-block;
}

.test-header h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 50%, #ec4899 100%);
  border-radius: 2px;
}

.test-info {
  display: none;
}

/* ---------- Question Card ---------- */
.question-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 20px 24px;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
}

.question-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.question-text {
  font-size: 1.05rem;
  color: var(--text-dark);
  line-height: 1.6;
  margin: 0;
}

/* Answer (only visible to teachers) */
.answer-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.answer-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.answer-text {
  font-size: 0.95rem;
  color: var(--text-dark);
  line-height: 1.5;
  margin: 0;
  background: #ecfdf5;
  padding: 12px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
}

/* ========================================
   SLIDESHOW TEST VIEW - CLEAN LIGHT DESIGN
   ======================================== */

.slideshow-container {
  position: relative;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========================================
   COMPACT CONTROLS SECTION
   ======================================== */

.controls-section {
  width: 100%;
  max-width: 780px;
  margin: 24px auto 0;
  display: flex;
  justify-content: center;
}

.controls-unified {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: white;
  padding: 12px 20px;
  border-radius: 100px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 700px;
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls-left {
  justify-content: flex-start;
}

.controls-right {
  justify-content: flex-end;
}

.controls-center {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px;
}

.control-group-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.control-group-inline i {
  color: var(--primary);
  font-size: 0.8rem;
}

.control-group-inline select {
  padding: 4px 8px;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
}

.control-btn {
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.control-btn.nav-btn {
  width: 36px;
  height: 36px;
  background: white;
  color: var(--text-medium);
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.control-btn.nav-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
  border-color: var(--primary);
}

.control-btn.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.control-btn.nav-btn:disabled:hover {
  background: #f1f5f9;
  color: var(--text-medium);
}

.control-btn.play-pause-btn {
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.control-btn.play-pause-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.control-btn.play-pause-btn.playing {
  background: var(--primary);
}

.control-btn.play-pause-btn.paused {
  background: var(--success);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.control-btn.play-pause-btn.paused:hover {
  background: var(--success-dark);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}



.slide-counter {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: 100px;
  margin-right: 4px;
  border: 1px solid var(--border);
}

/* Small Answer Badge for Controls */
.answer-badge-small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 4px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.answer-badge-small:hover {
  background: var(--success-dark);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.answer-badge-small i {
  font-size: 0.75rem;
}

/* Static Question Badge - Always visible */
.static-question-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  color: white;
  font-size: 1.3rem;
  font-weight: 800;
  padding: 16px 44px;
  border-radius: 100px;
  margin-bottom: 24px;
  box-shadow: 
    0 4px 16px rgba(99, 102, 241, 0.4),
    0 8px 32px rgba(139, 92, 246, 0.25);
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  z-index: 10;
  transition: transform 0.3s ease;
}

.static-question-badge.badge-pulse {
  animation: badgePulse 0.4s ease;
}

@keyframes badgePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Main Question Card - Clean & Light */
.slideshow-question {
  display: none;
  background: linear-gradient(145deg, #ffffff 0%, #fafbff 100%);
  border-radius: 24px;
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.02),
    0 12px 28px rgba(99, 102, 241, 0.1),
    0 24px 50px rgba(99, 102, 241, 0.08);
  padding: 60px 40px;
  text-align: center;
  border: 1px solid rgba(99, 102, 241, 0.12);
  min-height: 280px;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.slideshow-question.active {
  display: flex;
}

.slideshow-question::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 50%, #ec4899 100%);
  border-radius: 28px 28px 0 0;
}

.slideshow-question.active {
  display: flex;
}

@keyframes question-slide {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Old slideshow-number - now hidden since we use static badge */
.slideshow-number {
  display: none;
}
/* Question Text - Enhanced with Animation */
.slideshow-text {
  font-size: 1.65rem;
  color: var(--text-dark);
  line-height: 1.75;
  margin: 0;
  font-weight: 500;
  max-width: 100%;
  padding: 0 10px;
  letter-spacing: -0.2px;
  text-wrap: balance;
  word-wrap: break-word;
  opacity: 0;
  transform: translateY(15px);
  transition: none;
}

.slideshow-text.text-animate {
  animation: textFadeIn 0.5s ease forwards;
}

@keyframes textFadeIn {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ========================================
   ANSWER BADGE & MODAL - CLEAN STYLE
   ======================================== */

.answer-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
  z-index: 100;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.answer-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.answer-badge:active {
  transform: translateY(0);
}

.answer-badge i {
  font-size: 0.9rem;
}


/* ========================================
   MODAL STYLES - CLEAN DESIGN
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fade-in 0.2s ease;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  animation: modal-pop 0.3s ease;
  overflow: hidden;
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  background: var(--primary);
  color: white;
  padding: 24px;
  text-align: center;
}

.modal-header i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
}

.modal-body input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #f9fafb;
  font-size: 1rem;
  outline: none;
  transition: all var(--transition);
}

.modal-body input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.modal-time-selector {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.modal-time-selector label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-time-selector label i {
  color: var(--primary);
}

.modal-time-selector select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
}

.modal-time-selector select:focus {
  border-color: var(--primary);
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 0 24px 24px;
}

.modal-btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.modal-btn.cancel {
  background: #f1f5f9;
  color: var(--text-medium);
}

.modal-btn.cancel:hover {
  background: var(--border);
  color: var(--text-dark);
}

.modal-btn.confirm {
  background: var(--success);
  color: white;
}

.modal-btn.confirm:hover {
  background: var(--success-dark);
}

.modal-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Answer Modal Styles */
.answer-modal {
  max-width: 520px;
}

.answer-modal-header {
  background: var(--success) !important;
}

.answer-modal-body {
  padding: 0 !important;
}

.answer-modal-question {
  padding: 20px 24px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
}

.answer-modal-answer {
  padding: 20px 24px;
  background: #ecfdf5;
}

.answer-modal-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.answer-modal-question .answer-modal-label {
  color: var(--primary);
}

.answer-modal-answer .answer-modal-label {
  color: var(--success);
}

.answer-modal-question p,
.answer-modal-answer p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-dark);
  white-space: pre-wrap;
}

.answer-modal-question p {
  font-weight: 500;
}

/* ---------- Loading Spinner ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-medium);
}

.loading i {
  font-size: 2rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-medium);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 14px 20px;
  background: var(--text-dark);
  color: #fff;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.3s ease;
  z-index: 9999;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: #ef4444;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 900px) {
  .app-header h1 {
    font-size: 1.4rem;
  }
  
  .input-section,
  .links-section {
    padding: 16px;
  }
  
  .dual-textarea-container {
    grid-template-columns: 1fr;
  }
  
  .formatted-editor {
    min-height: 400px;
  }
  
  .send-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }
  
  .link-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .link-actions {
    width: 100%;
  }
  
  .link-btn {
    flex: 1;
    justify-content: center;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
/* Test Page Mobile */
  .test-header h1 {
    font-size: 1.5rem;
  }
  
  .test-info {
    font-size: 0.85rem;
    padding: 6px 14px;
  }
  
.slideshow-question {
    padding: 50px 28px 40px;
    min-height: 300px;
    border-radius: 20px;
  }
  
  .slideshow-question::before {
    height: 3px;
    border-radius: 20px 20px 0 0;
  }
  
  .slideshow-number {
    font-size: 1.05rem;
    padding: 12px 28px;
  }
  
  .slideshow-text {
    font-size: 1.3rem;
  }
  
  .controls-section {
    padding: 16px 20px;
  }
  
.control-btn.nav-btn {
    width: 34px;
    height: 34px;
  }

  .control-btn.play-pause-btn {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .test-container {
    padding: 24px 16px 40px;
  }
  
  .test-header {
    margin-bottom: 24px;
  }
  
.controls-section {
    margin-top: 16px;
  }
  
.controls-single-row {
    gap: 8px;
    padding: 8px 14px;
  }
  
  .control-btn.nav-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  
  .control-btn.play-pause-btn {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }
  
  .slide-counter {
    font-size: 0.75rem;
    padding: 4px 10px;
  }
  
  .answer-modal {
    margin: 15px;
    max-width: calc(100% - 30px);
  }
  
  .answer-modal-question,
  .answer-modal-answer {
    padding: 16px 18px;
  }
  
  .answer-modal-question p,
  .answer-modal-answer p {
    font-size: 0.95rem;
  }
}




/* Animation Styles for Text */
.slideshow-text.anim-fadeUp {
  animation: animFadeUp 0.5s ease forwards;
}

.slideshow-text.anim-fadeIn {
  animation: animFadeIn 0.5s ease forwards;
}

.slideshow-text.anim-zoomIn {
  animation: animZoomIn 0.5s ease forwards;
}

.slideshow-text.anim-slideLeft {
  animation: animSlideLeft 0.5s ease forwards;
}

.slideshow-text.anim-slideRight {
  animation: animSlideRight 0.5s ease forwards;
}

.slideshow-text.anim-bounce {
  animation: animBounce 0.6s ease forwards;
}

.slideshow-text.anim-typewriter {
  animation: animTypewriter 0.8s steps(40) forwards;
  overflow: hidden;
  white-space: nowrap;
}

@keyframes animFadeUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes animFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes animZoomIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes animSlideLeft {
  0% { opacity: 0; transform: translateX(50px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes animSlideRight {
  0% { opacity: 0; transform: translateX(-50px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes animBounce {
  0% { opacity: 0; transform: scale(0.5); }
  60% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes animTypewriter {
  0% { width: 0; opacity: 1; }
  100% { width: 100%; opacity: 1; }
}

/* Mobile responsive for unified controls */
@media (max-width: 700px) {
  .controls-unified {
    flex-direction: column;
    gap: 10px;
    border-radius: 20px;
    padding: 14px;
  }
  
  .controls-left,
  .controls-right {
    justify-content: center;
    width: 100%;
    gap: 8px;
  }
  
  .controls-center {
    order: -1;
    margin: 0;
  }
}