@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;700&display=swap');

/* ============================= */
/* RESET */
/* ============================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, button, input, textarea, select {
  font-family: 'IBM Plex Sans Arabic', sans-serif !important;
}

html, body {
  direction: rtl;
  background: #f4f6f9;
  color: #1f2937;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
}

/* ============================= */
/* PREMIUM MICRO POLISH VARIABLES */
/* ============================= */

:root {
  --ease-soft: cubic-bezier(.4,0,.2,1);
}

/* ============================= */
/* PERFORMANCE OPTIMIZATION */
/* ============================= */

.page,
.question-container,
.answers {
  will-change: opacity, transform;
}

/* ============================= */
/* CONTAINER */
/* ============================= */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 40px;
  background: linear-gradient(to bottom, #ffffff, #fcfdff);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@media (min-width: 768px) {
  .container {
    margin: 60px auto;
    padding: 50px 40px;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    min-height: auto;
  }
}

@media (max-width: 767px) {
  .container {
    border-radius: 14px;
    margin: 12px;
  }
}

/* ============================= */
/* HEADER */
/* ============================= */

.header {
  text-align: center;
  margin-bottom: 24px;
}

.logo {
  max-height: 50px;
}

/* ============================= */
/* PAGE VISIBILITY */
/* ============================= */

.page {
  display: none;
}

.page.active {
  display: block;
}

/* Intro Centering */

#intro {
  text-align: center;
}

#intro.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 70vh;
}

#intro p {
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================= */
/* TYPOGRAPHY */
/* ============================= */

h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

p {
  font-size: 15px;
  margin-bottom: 16px;
  color: #4b5563;
}

@media (min-width: 768px) {
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  p  { font-size: 16px; }
}

/* ============================= */
/* QUIZ */
/* ============================= */

.question-container {
  margin-bottom: 20px;
  text-align: center;
  transition:
    opacity 0.28s var(--ease-soft),
    transform 0.28s var(--ease-soft);
}

#counter {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  transition:
    opacity 0.28s var(--ease-soft),
    transform 0.28s var(--ease-soft);
}

/* Transition helpers */

.fade-out {
  opacity: 0;
  transform: translateY(10px) scale(0.99);
}

.fade-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ============================= */
/* ANSWER BUTTONS */
/* ============================= */

.answer-btn {
  position: relative;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #dab49430;
  background: #f9fafb;
  font-size: 15px;
  cursor: pointer;
  transition:
    background 0.22s var(--ease-soft),
    border-color 0.22s var(--ease-soft),
    transform 0.15s var(--ease-soft),
    box-shadow 0.22s var(--ease-soft),
    opacity 0.2s var(--ease-soft);
}

@media (hover: hover) {
  .answer-btn:hover {
    background: #f5f5f5;
    border-color: #bc773e;
    box-shadow: 0 6px 14px rgba(0,0,0,0.05);
  }
}

.answer-btn:active {
  transform: scale(0.97);
}

.answer-btn.selected {
  background: #0e413a;
  color: #ffffff;
  border-color: #0e413a;
  box-shadow: 0 8px 24px rgba(37,99,235,0.28);
  animation: softPulse 0.9s ease-out;
}

@keyframes softPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37,99,235,0.35);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(37,99,235,0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37,99,235,0);
  }
}

.answer-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================= */
/* MAIN BUTTONS */
/* ============================= */

button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 16px 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition:
    background 0.22s var(--ease-soft),
    transform 0.15s var(--ease-soft),
    box-shadow 0.22s var(--ease-soft);
}

button:active {
  transform: scale(0.97);
}

.primary-btn {
  background: #0e413a;
  color: #ffffff;
  margin-top: 24px;
  box-shadow: 0 10px 25px rgba(37,99,235,0.25);
}

.secondary-btn {
  background: #111827;
  color: #ffffff;
  margin-top: 28px;
}

@media (hover: hover) {
  .primary-btn:hover {
    background: #bc763c;
    box-shadow: 0 14px 30px rgba(37,99,235,0.35);
  }

  .secondary-btn:hover {
    background: #0f172a;
  }
}

/* ============================= */
/* PROGRESS BAR */
/* ============================= */

.progress-bar {
  height: 8px;
  background: #dab49430;
  border-radius: 8px;
  margin-top: 20px;
  overflow: hidden;
}

#progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #bc773e, #bc773e);
  transition: width 0.45s cubic-bezier(.4,0,.2,1);
}

/* ============================= */
/* LOADER */
/* ============================= */

.loader-container {
  text-align: center;
  padding: 40px 0;
}

.spinner {
  margin: 20px auto;
  width: 36px;
  height: 36px;
  border: 4px solid #dab49430;
  border-top: 4px solid #0e413a;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ============================= */
/* RESULT */
/* ============================= */

#score {
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

#detailed-result {
  margin-bottom: 24px;
  text-align: center;
}

/* ============================= */
/* SHARE */
/* ============================= */

.share-section {
  margin-top: 32px;
  text-align: center;
}

.share-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.share-buttons a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: white;
  text-decoration: none;
  transition:
    transform 0.2s var(--ease-soft),
    opacity 0.2s var(--ease-soft);
}

.share-buttons a:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.facebook { background: #1877f2; }
.twitter { background: #1da1f2; }
.whatsapp { background: #25d366; }
.linkedin { background: #0a66c2; }

/* ============================= */
/* FOOTER */
/* ============================= */

.footer {
  margin-top: auto;
  text-align: center;
  padding: 12px;
  font-size: 13px;
  border-top: 1px solid #dab49430;
  color: #6b7280;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(6px);
}

/* ============================= */
/* MICRO INTERACTION SUPPORT */
/* ============================= */

button,
.answer-btn,
.share-icon {
  touch-action: manipulation;
}

*:focus-visible {
  outline: 2px solid #0e413a;
  outline-offset: 2px;
}

/* Accessibility motion reduction */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}