/* ==========================================================================
   CSS STYLES - ТУРКИШ ОНЛИ MINI-APP QUIZ
   Supports Telegram WebApp Theme & Standalone Web
   ========================================================================== */

:root {
  /* Fallback Brand Colors */
  --bg-primary: var(--tg-theme-bg-color, #F8FAFC);
  --bg-card: var(--tg-theme-secondary-bg-color, #FFFFFF);
  --text-main: var(--tg-theme-text-color, #0F172A);
  --text-muted: var(--tg-theme-hint-color, #64748B);
  --text-light: #94A3B8;

  --accent-red: #E30A17; /* Turkish flag red */
  --accent-red-light: #FEE2E2;
  --accent-red-hover: #C50813;

  --btn-primary-bg: var(--tg-theme-button-color, #E30A17);
  --btn-primary-text: var(--tg-theme-button-text-color, #FFFFFF);

  --color-success: #10B981;
  --color-success-bg: #ECFDF5;
  --color-success-border: #A7F3D0;

  --color-error: #EF4444;
  --color-error-bg: #FEF2F2;
  --color-error-border: #FECACA;

  --border-subtle: #E2E8F0;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 12px 32px rgba(15, 23, 42, 0.08);

  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px;
}

.app-container {
  width: 100%;
  max-width: 520px;
  min-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 18px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.flag-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.brand-name {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.2px;
  color: var(--text-main);
}

.header-level {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: linear-gradient(135deg, #E30A17, #B91C1C);
  color: #FFFFFF;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(227, 10, 23, 0.25);
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
  display: flex;
}

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

/* Cards */
.hero-card, .quiz-card, .result-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

/* User Greeting Badge */
.user-greeting-badge {
  display: inline-flex;
  align-items: center;
  background: #F1F5F9;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* Input / Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 1.1rem;
  pointer-events: none;
}

.text-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.98rem;
  font-family: inherit;
  color: var(--text-main);
  background: #FFFFFF;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.text-input:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(227, 10, 23, 0.12);
}

/* Warning Box for Repeat Attempt */
.warning-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: #92400E;
  font-size: 0.85rem;
  line-height: 1.4;
  animation: fadeIn 0.25s ease forwards;
}

.warning-icon {
  font-size: 1.3rem;
  line-height: 1.2;
}

.warning-content strong {
  display: block;
  font-size: 0.88rem;
  color: #78350F;
  margin-bottom: 2px;
}

/* Hero / Welcome */
.spots-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-red-light);
  color: var(--accent-red);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
  border: 1px solid rgba(227, 10, 23, 0.15);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-red);
  box-shadow: 0 0 0 0 rgba(227, 10, 23, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(227, 10, 23, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(227, 10, 23, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(227, 10, 23, 0);
  }
}

.hero-title {
  font-size: 1.42rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.hero-desc {
  font-size: 0.94rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 20px;
}

.features-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-primary);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.feature-icon {
  font-size: 1.3rem;
  line-height: 1.2;
}

.feature-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feature-text strong {
  font-size: 0.88rem;
  color: var(--text-main);
}

.feature-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.info-note {
  font-size: 0.85rem;
  color: #475569;
  background: #F1F5F9;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  border-left: 3px solid var(--accent-red);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 0.98rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
  user-select: none;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: 0 4px 14px rgba(227, 10, 23, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
  filter: brightness(0.92);
}

.btn-tg {
  background: #2AABEE;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.35);
}

.btn-tg:active {
  transform: scale(0.98);
  filter: brightness(0.92);
}

.tg-icon {
  width: 20px;
  height: 20px;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border-subtle);
}

.btn-outline:active {
  background: #F1F5F9;
}

.btn-arrow {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

/* Quiz Progress */
.quiz-progress-bar-wrap {
  margin-bottom: 14px;
  padding: 0 4px;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.counter-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.score-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #E30A17, #FF5252);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* Quiz Card */
.topic-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748B;
  background: #F1F5F9;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.question-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 20px;
  color: var(--text-main);
}

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

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  text-align: left;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.option-btn:hover:not(.disabled) {
  border-color: #CBD5E1;
  background: #F8FAFC;
}

.option-btn:active:not(.disabled) {
  transform: scale(0.99);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: #F1F5F9;
  color: #475569;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.option-text {
  flex: 1;
  font-weight: 500;
  line-height: 1.35;
}

/* Option States after selection */
.option-btn.correct {
  border-color: var(--color-success);
  background-color: var(--color-success-bg);
  color: #065F46;
}

.option-btn.correct .option-letter {
  background: var(--color-success);
  color: #FFFFFF;
}

.option-btn.incorrect {
  border-color: var(--color-error);
  background-color: var(--color-error-bg);
  color: #991B1B;
}

.option-btn.incorrect .option-letter {
  background: var(--color-error);
  color: #FFFFFF;
}

.option-btn.disabled {
  cursor: default;
}

.option-status-icon {
  font-size: 1.1rem;
  margin-left: auto;
}

/* Explanation Box */
.explanation-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius-md);
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  animation: fadeIn 0.25s ease forwards;
}

.explanation-box.correct-box {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
}

.explanation-box.incorrect-box {
  background: var(--color-error-bg);
  border-color: var(--color-error-border);
}

.explanation-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.explanation-content strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 2px;
  color: var(--text-main);
}

.explanation-content p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Results Screen */
.result-header {
  text-align: center;
  padding: 10px 0 16px;
}

.result-badge-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
}

.score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.score-big {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
  letter-spacing: -1px;
}

.score-max {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-muted);
}

.result-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text-main);
}

.result-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.verdict-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.verdict-banner.success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: #065F46;
}

.verdict-banner.warning {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
}

.verdict-banner.starter {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #334155;
}

.verdict-icon {
  font-size: 1.4rem;
  line-height: 1;
}

/* ==========================================================================
   SPECIAL DISCOUNT SECTION & PULSING 48-HOUR TIMER
   ========================================================================== */
.discount-card {
  background: linear-gradient(145deg, #FFF1F2 0%, #FFFFFF 100%);
  border: 2px solid #FCA5A5;
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin-bottom: 22px;
  box-shadow: 0 8px 20px rgba(227, 10, 23, 0.08);
  position: relative;
  overflow: hidden;
}

.discount-header {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.discount-tag {
  background: linear-gradient(135deg, #E30A17, #B91C1C);
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(227, 10, 23, 0.25);
}

.discount-intro {
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1F2937;
  line-height: 1.45;
  margin-bottom: 14px;
}

.pricing-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #FFFFFF;
  border: 1.5px solid #FEE2E2;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.price-old-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.price-new-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.price-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #94A3B8;
  margin-bottom: 2px;
}

/* Strikethrough 18 000 */
.price-old {
  font-size: 1.25rem;
  font-weight: 700;
  color: #94A3B8;
  text-decoration: line-through;
  text-decoration-color: #EF4444;
  text-decoration-thickness: 2.5px;
}

.price-arrow {
  font-size: 1.2rem;
  color: #CBD5E1;
  font-weight: 800;
}

/* Big prominent 16 000 */
.price-new {
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1;
  color: #E30A17;
  letter-spacing: -0.6px;
  text-shadow: 0 2px 8px rgba(227, 10, 23, 0.2);
}

/* Pulsing 48h timer badge */
.pulse-timer-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #FEF2F2;
  border: 1.5px solid #EF4444;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
  animation: pulseTimerGlow 1.8s infinite ease-in-out;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
}

.pulse-timer-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #B91C1C;
  font-weight: 800;
  font-size: 0.95rem;
}

.pulse-timer-extra {
  font-size: 0.82rem;
  font-weight: 600;
  color: #991B1B;
  line-height: 1.35;
}

.pulse-timer-icon {
  font-size: 1.15rem;
  animation: swingHourglass 2.4s infinite ease-in-out;
}

@keyframes pulseTimerGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
    background-color: #FEF2F2;
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 16px 4px rgba(239, 68, 68, 0.28);
    background-color: #FEE2E2;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
    background-color: #FEF2F2;
  }
}

@keyframes swingHourglass {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(12deg);
  }
  75% {
    transform: rotate(-12deg);
  }
}

/* CTA Box */
.cta-box {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border-subtle);
}

.cta-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.cta-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 14px;
}

.copy-field-wrap {
  margin-top: 14px;
}

.copy-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.copy-box {
  background: #FFFFFF;
  border: 1.5px dashed #CBD5E1;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.copy-text {
  font-size: 0.82rem;
  color: #334155;
  font-style: italic;
  line-height: 1.35;
  flex: 1;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: #F1F5F9;
  color: #0F172A;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-copy svg {
  width: 14px;
  height: 14px;
}

.btn-copy:active {
  background: #E2E8F0;
  transform: scale(0.96);
}

/* Review Accordion */
.review-accordion {
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #F8FAFC;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
}

.chevron-icon {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.accordion-header.open .chevron-icon {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 14px;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
}

.review-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #F8FAFC;
  border-left: 3px solid #CBD5E1;
  font-size: 0.82rem;
}

.review-item.correct {
  border-left-color: var(--color-success);
}

.review-item.incorrect {
  border-left-color: var(--color-error);
}

.review-q {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.review-ans {
  color: var(--text-muted);
}

.review-ans span {
  font-weight: 600;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 20px 4px 12px;
  font-size: 0.78rem;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.footer-dot {
  opacity: 0.5;
}

.admin-link-wrap {
  margin-top: 4px;
}

.admin-footer-link {
  font-size: 0.75rem;
  color: #94A3B8 !important;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.03);
  transition: all var(--transition-fast);
}

.admin-footer-link:hover {
  color: var(--text-main) !important;
  background: rgba(0, 0, 0, 0.06);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0F172A;
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  animation: toastFade 0.3s ease forwards;
}

@keyframes toastFade {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.hidden {
  display: none !important;
}

.mt-4 {
  margin-top: 14px;
}
