/* ============================================================================
   Infinity Slides - Interactive Presentation Widgets Styles
   Live Polls, Interactive Quizzes, and Animated Countdown Timers
   ============================================================================ */

/* Common Widget Container inside Slides */
.slide-interactive-widget {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface, #ffffff);
  border-radius: 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  font-family: inherit;
  user-select: none;
}

/* --------------------------------------------------------------------------
   1. Live Poll Widget
   -------------------------------------------------------------------------- */
.widget-poll-card {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.widget-poll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.widget-poll-badge {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.widget-poll-total {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}

.widget-poll-question {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  margin-bottom: 14px;
  line-height: 1.35;
}

.widget-poll-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}

.widget-poll-option-row {
  position: relative;
  background: var(--bg-surface-secondary, #f8fafc);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
}

.widget-poll-option-row:hover {
  border-color: #2563eb;
  background: #f1f5f9;
}

.widget-poll-option-row.voted {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.widget-poll-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: rgba(37, 99, 235, 0.15);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
}

.widget-poll-opt-label {
  position: relative;
  z-index: 2;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main, #1e293b);
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-poll-opt-stats {
  position: relative;
  z-index: 2;
  font-size: 0.8rem;
  font-weight: 700;
  color: #2563eb;
}

/* --------------------------------------------------------------------------
   2. Interactive Quiz Widget
   -------------------------------------------------------------------------- */
.widget-quiz-card {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.widget-quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.widget-quiz-badge {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.widget-quiz-question {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  margin-bottom: 12px;
}

.widget-quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.widget-quiz-choice {
  padding: 10px 14px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-surface-secondary, #f8fafc);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main, #1e293b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.18s ease;
}

.widget-quiz-choice:hover:not(.disabled) {
  background: #f1f5f9;
  border-color: #3b82f6;
}

.widget-quiz-choice.correct {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.widget-quiz-choice.wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.widget-quiz-feedback {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.widget-quiz-feedback.show-correct {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #dcfce7;
  color: #15803d;
}

.widget-quiz-feedback.show-wrong {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fee2e2;
  color: #b91c1c;
}

/* --------------------------------------------------------------------------
   3. Animated Countdown Timer Widget
   -------------------------------------------------------------------------- */
.widget-timer-card {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  box-sizing: border-box;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.widget-timer-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 8px;
}

.widget-timer-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #38bdf8;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
  line-height: 1;
  margin: 6px 0 12px 0;
}

.widget-timer-display.timer-ended {
  color: #ef4444;
  animation: pulseEnd 0.6s infinite alternate;
}

@keyframes pulseEnd {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.05); opacity: 1; text-shadow: 0 0 25px rgba(239, 68, 68, 0.8); }
}

.widget-timer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-timer-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.widget-timer-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #ffffff;
}

.widget-timer-btn.btn-timer-primary {
  background: #0284c7;
  border-color: #38bdf8;
}

.widget-timer-btn.btn-timer-primary:hover {
  background: #0369a1;
}

/* Modal Creation Dialogs */
.widget-builder-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-builder-card {
  width: 90%;
  max-width: 520px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: modalScale 0.18s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.widget-builder-header {
  padding: 14px 18px;
  background: linear-gradient(90deg, #ea580c, #f97316);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-builder-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-builder-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.2rem;
  cursor: pointer;
}

.widget-builder-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-main, #1e293b);
  max-height: 70vh;
  overflow-y: auto;
}

.widget-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.widget-form-label {
  font-weight: 700;
  color: var(--text-main, #334155);
}

.widget-form-input {
  padding: 8px 10px;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  background: var(--bg-surface, #ffffff);
  color: var(--text-main, #1e293b);
  outline: none;
  font-family: inherit;
  font-size: 0.82rem;
}

.widget-form-input:focus {
  border-color: #ea580c;
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}

.widget-builder-footer {
  padding: 12px 18px;
  background: var(--bg-surface-secondary, #f8fafc);
  border-top: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
