/* CSS Design System & Layout for CyberSecurity Join Portal */

:root {
  /* Design Tokens */
  --bg-primary: #080c14;
  --bg-secondary: #0d1322;
  --card-bg: #12192c;
  --border-color: rgba(59, 130, 246, 0.15);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Glowing / Accents (No Green, No Bright Red/Pink) */
  --accent-purple: #8b5cf6;
  --accent-blue: #0b64f1;
  --accent-cyan: #06b6d4;
  --accent-warning: #e2e8f0;
  /* Keeping warning warning-free and neutral */
  --accent-gray: #475569;

  --purple-glow: rgba(90, 85, 102, 0.3);
  --blue-glow: rgba(59, 130, 246, 0.3);
  --cyan-glow: rgba(6, 182, 212, 0.2);

  --font-family: 'Tajawal', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  background-image: url('../images/background.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--text-primary);
  font-family: var(--font-family);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 16px;
}

/* App Container */
.app-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: rgba(13, 19, 34, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 600px;
  z-index: 1;
}

/* Cyber Glow Background Ornaments */
.cyber-glow {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  z-index: -1;
}

.bg-glow-1 {
  top: -80px;
  right: -80px;
  background: var(--accent-purple);
}

.bg-glow-2 {
  bottom: -80px;
  left: -80px;
  background: var(--accent-blue);
}

/* Header Styling */
.app-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo-shield {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: var(--text-primary);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
  margin-bottom: 8px;
  animation: pulseShield 3s infinite ease-in-out;
}

.logo-shield svg {
  width: 28px;
  height: 28px;
}

.group-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(to left, var(--text-primary), #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.group-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Card Body & Routing Views */
.card-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.view-section {
  display: none;
  flex-direction: column;
  flex-grow: 1;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-section.active {
  display: flex;
}

/* SCREEN 1: Quiz Styling */
.quiz-progress-container {
  margin-bottom: 20px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-track {
  height: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(to left, var(--accent-blue), var(--accent-purple));
  border-radius: 3px;
  transition: width 0.4s ease-out;
  box-shadow: 0 0 8px var(--purple-glow);
}

.question-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 24px;
}

.question-text {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 20px;
  color: var(--text-primary);
}

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

/* Option Buttons */
.option-btn {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-family);
  font-weight: 500;
  text-align: right;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  outline: none;
}

.option-btn:hover {
  border-color: rgba(139, 92, 246, 0.4);
  background-color: rgba(139, 92, 246, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.1);
}

.option-btn:active {
  transform: translateY(0);
}

.option-btn.selected {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border-color: var(--accent-purple);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.2);
}

/* Footer & Global Buttons */
.quiz-footer {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  justify-content: center;
}

.primary-btn,
.secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(139, 92, 246, 0.35);
}

.primary-btn:active {
  transform: translateY(0);
}

.secondary-btn {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

/* SCREEN 2: Rules Styling */
.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rules-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.rule-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: 16px;
  transition: transform 0.2s ease;
}

.rule-card:hover {
  transform: scale(1.02);
  border-color: rgba(59, 130, 246, 0.3);
}

.rule-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
}

.rule-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.rules-footer {
  margin-top: auto;
  padding-top: 12px;
}

/* SCREEN 3 & 4: Success & Failure Views */
.text-center {
  text-align: center;
  align-items: center;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 20px;
}

.status-icon svg {
  width: 36px;
  height: 36px;
}

.success-icon {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.2);
}

.failure-icon {
  background-color: rgba(71, 85, 105, 0.1);
  color: var(--accent-warning);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.05);
}

.status-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
}

.status-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 320px;
  margin-bottom: 24px;
}

.status-text.font-accent {
  color: var(--accent-blue);
  font-weight: 600;
}

/* Dynamic Countdown circle loader */
.countdown-container {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.countdown-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.03);
  stroke-width: 5;
}

.countdown-progress {
  fill: none;
  stroke: var(--accent-blue);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 220;
  /* Circumference of circle with r=35 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear;
}

.countdown-text {
  position: absolute;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.countdown-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.success-footer,
.failure-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}

.failure-message-box {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  padding: 16px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  text-align: right;
}

/* Branding footer */
.app-footer-brand {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  text-align: center;
}

.app-footer-brand p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Utility Helpers */
.w-full {
  width: 100%;
}

.mt-10 {
  margin-top: 10px;
}

.no-underline {
  text-decoration: none;
}

.text-warning {
  color: var(--text-primary);
}

/* Animation Keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseShield {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
  }
}