/* ==========================================================================
   PYQ PREMIUM MODAL — Daylight / Neumorphic / Apple-inspired Design
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --pyq-primary:     #5b5cf6;
  --pyq-primary-2:   #7c5cfc;
  --pyq-surface:     #ffffff;
  --pyq-bg-soft:     #f4f6fb;
  --pyq-border:      rgba(226, 232, 240, 0.9);
  --pyq-text:        #1e293b;
  --pyq-muted:       #64748b;
  --pyq-light:       #94a3b8;
  --pyq-shadow-sm:   0 2px 8px rgba(0,0,0,.06);
  --pyq-shadow-md:   0 8px 32px rgba(71,64,196,.14), 0 2px 8px rgba(0,0,0,.06);
  --pyq-shadow-lg:   0 24px 64px rgba(71,64,196,.18), 0 8px 24px rgba(0,0,0,.10);
  --pyq-radius:      24px;
  --pyq-font:        'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

/* ── Overlay ────────────────────────────────────────────────────── */
.pyq-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pyq-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.pyq-visible {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
  animation: pyqOverlayIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.pyq-closing {
  animation: pyqOverlayOut 0.28s ease forwards;
}

@keyframes pyqOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pyqOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── App blur when modal is open ────────────────────────────────── */
.pyq-app-blurred {
  filter: blur(3px) brightness(0.95);
  transform: scale(0.99);
  transition: filter 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  user-select: none;
}

/* ── Modal Card ─────────────────────────────────────────────────── */
.pyq-modal-card {
  background: var(--pyq-surface);
  border-radius: var(--pyq-radius);
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow: hidden;
  box-shadow: var(--pyq-shadow-lg);
  position: relative;
  animation: pyqCardIn 0.38s cubic-bezier(0.34, 1.44, 0.64, 1) both;
  display: flex;
  flex-direction: column;
  font-family: var(--pyq-font);
  border: 1px solid rgba(255,255,255,0.9);
}

.pyq-closing .pyq-modal-card {
  animation: pyqCardOut 0.25s ease forwards;
}

@keyframes pyqCardIn {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

@keyframes pyqCardOut {
  from { opacity: 1; transform: scale(1)    translateY(0);  }
  to   { opacity: 0; transform: scale(0.92) translateY(12px); }
}

/* ── Close Button ───────────────────────────────────────────────── */
.pyq-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  z-index: 10;
  transition: background 0.18s, transform 0.18s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.pyq-close-btn:hover,
.pyq-close-btn:active {
  background: #e2e8f0;
  transform: scale(1.08);
}

/* ── Step Container ─────────────────────────────────────────────── */
.pyq-step {
  flex-direction: column;
  align-items: center;
  padding: 36px 28px 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  min-height: 320px;
}

/* ── Sparkle Dots ───────────────────────────────────────────────── */
.pyq-sparkle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.pyq-sparkle-1 {
  width: 8px; height: 8px;
  background: #f43f5e;
  top: 28px; left: 28px;
  animation: pyqSparkle 2.4s ease-in-out infinite;
}
.pyq-sparkle-2 {
  width: 6px; height: 6px;
  background: #7c5cfc;
  top: 52px; right: 56px;
  animation: pyqSparkle 3.1s ease-in-out infinite 0.7s;
}
.pyq-sparkle-3 {
  width: 5px; height: 5px;
  background: #22c55e;
  bottom: 100px; left: 36px;
  animation: pyqSparkle 2.8s ease-in-out infinite 1.2s;
}
.pyq-sparkle-4 {
  width: 7px; height: 7px;
  background: #0ea5e9;
  bottom: 80px; right: 32px;
  animation: pyqSparkle 3.4s ease-in-out infinite 0.3s;
}

@keyframes pyqSparkle {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.4); }
}

/* ── Step 1 — Logo ──────────────────────────────────────────────── */
.pyq-logo-wrap {
  position: relative;
  margin-bottom: 24px;
}

/* Decorative elements */
.pyq-deco {
  position: absolute;
  color: var(--pyq-primary);
  opacity: 0.6;
  font-size: 14px;
  animation: pyqDecoFloat 4s ease-in-out infinite alternate;
}
.pyq-deco-a { top: -30px; left: -40px; font-size: 16px; color: #f43f5e; }
.pyq-deco-b { top: 30px; left: -60px; font-size: 18px; color: #7c5cfc; animation-delay: 0.5s; }
.pyq-deco-c { top: 90px; left: -45px; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; animation-delay: 1.2s; }
.pyq-deco-d { bottom: -35px; left: -15px; font-size: 12px; color: #0ea5e9; animation-delay: 0.3s; }
.pyq-deco-e { bottom: -10px; right: -50px; font-size: 16px; color: #f43f5e; animation-delay: 0.8s; }
.pyq-deco-f { top: 50px; right: -65px; width: 4px; height: 4px; border-radius: 50%; background: #7c5cfc; animation-delay: 1.5s; }
.pyq-deco-g { top: -20px; right: -40px; font-size: 14px; color: #eab308; animation-delay: 0.2s; }
.pyq-deco-h { top: -45px; right: 25px; font-size: 12px; color: #22c55e; animation-delay: 0.9s; }
.pyq-deco-i { bottom: -30px; right: -20px; width: 5px; height: 5px; border-radius: 50%; background: #0ea5e9; animation-delay: 0.6s; }
.pyq-deco-j { top: 110px; right: 35px; font-size: 10px; color: #7c5cfc; animation-delay: 1.1s; }

@keyframes pyqDecoFloat {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  100% { transform: translateY(-6px) rotate(10deg) scale(1.1); }
}

.pyq-logo-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, #e6ebf5);
  box-shadow:
    10px 10px 20px rgba(71,64,196,0.15), 
    -8px -8px 16px rgba(255,255,255,1),
    inset 2px 2px 4px rgba(255,255,255,0.8),
    inset -2px -2px 4px rgba(71,64,196,0.05);
  border: 1px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pyqLogoPulse 3s ease-in-out infinite;
  overflow: hidden;
  padding: 0;
}

.pyq-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.15);
}

.pyq-s2-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.15);
}

@keyframes pyqLogoPulse {
  0%, 100% {
    box-shadow: 
      10px 10px 20px rgba(71,64,196,0.15), 
      -8px -8px 16px rgba(255,255,255,1),
      inset 2px 2px 4px rgba(255,255,255,0.8),
      inset -2px -2px 4px rgba(71,64,196,0.05);
  }
  50% {
    box-shadow: 
      12px 12px 24px rgba(71,64,196,0.2), 
      -10px -10px 20px rgba(255,255,255,1),
      inset 2px 2px 4px rgba(255,255,255,0.8),
      inset -2px -2px 4px rgba(71,64,196,0.05);
  }
}

/* ── Step 1 — Branding ──────────────────────────────────────────── */
.pyq-brand-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--pyq-text);
  text-align: center;
  margin-bottom: 10px;
  font-family: var(--pyq-font);
}

/* Decorated Subtitle Divider */
.pyq-brand-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
  width: 100%;
}

.pyq-bdiv-line {
  height: 1px;
  width: 40px;
  background: linear-gradient(to right, transparent, #cbd5e1);
}
.pyq-brand-divider .pyq-bdiv-line:last-child {
  background: linear-gradient(to left, transparent, #cbd5e1);
}

.pyq-bdiv-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  border: 1px solid #94a3b8;
  background: transparent;
}

.pyq-bdiv-text {
  font-size: 13px;
  color: var(--pyq-muted);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── Step 1 — Feature Card ──────────────────────────────────────── */
.pyq-feature-card {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--pyq-border);
  border-radius: 18px;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow:
    0 4px 16px rgba(91,92,246,0.10),
    0 1px 4px rgba(0,0,0,0.05);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.18s ease,
              border-color 0.18s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.pyq-feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(91,92,246,0.04), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}

.pyq-feature-card:active {
  transform: scale(0.975);
}

.pyq-feature-card:hover {
  border-color: #b8b5f5;
  box-shadow:
    0 8px 28px rgba(91,92,246,0.16),
    0 2px 6px rgba(0,0,0,0.06);
}
.pyq-feature-card:hover::before { opacity: 1; }

/* Right border accent */
.pyq-feature-card::after {
  content: '';
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 2px 0 0 2px;
  background: linear-gradient(to bottom, var(--pyq-primary), var(--pyq-primary-2));
}

.pyq-fc-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(91,92,246,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--pyq-primary);
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.8);
}

.pyq-fc-body { flex: 1; }
.pyq-fc-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--pyq-text);
  margin-bottom: 3px;
  font-family: var(--pyq-font);
}
.pyq-fc-sub {
  font-size: 12px;
  color: var(--pyq-muted);
  font-weight: 500;
}

.pyq-fc-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(91,92,246,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pyq-primary);
  flex-shrink: 0;
  transition: background 0.18s, transform 0.18s;
}
.pyq-feature-card:hover .pyq-fc-arrow {
  background: var(--pyq-primary);
  color: white;
  transform: translateX(3px);
}

/* Star Divider */
.pyq-star-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

.pyq-sd-line {
  height: 1px;
  width: 60px;
  background: linear-gradient(to right, transparent, #e2e8f0);
}
.pyq-star-divider .pyq-sd-line:last-child {
  background: linear-gradient(to left, transparent, #e2e8f0);
}

.pyq-sd-star {
  color: var(--pyq-primary);
  font-size: 14px;
}

/* ── Step 1 — Footer Text ───────────────────────────────────────── */
.pyq-modal-footer-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--pyq-muted);
  font-weight: 500;
  text-align: center;
}

.pyq-footer-star {
  color: var(--pyq-primary);
  font-size: 14px;
  animation: pyqStarSpin 4s linear infinite;
}

@keyframes pyqStarSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Step 2 — Header ────────────────────────────────────────────── */
.pyq-s2-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-right: 40px; /* room for close btn */
  width: 100%;
}

.pyq-s2-logo-small {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(145deg, #f0f4ff, #e8ecf8);
  box-shadow: 4px 4px 10px rgba(71,64,196,0.12), -2px -2px 8px rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.pyq-s2-header-text { flex: 1; }
.pyq-s2-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--pyq-text);
  letter-spacing: -0.3px;
  font-family: var(--pyq-font);
}
.pyq-s2-sub {
  font-size: 13px;
  color: var(--pyq-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ── Section Labels ─────────────────────────────────────────────── */
.pyq-section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--pyq-text);
  margin-bottom: 12px;
  width: 100%;
  font-family: var(--pyq-font);
}

.pyq-subject-badge {
  color: var(--pyq-primary);
  font-weight: 700;
}

/* ── Subject Grid ───────────────────────────────────────────────── */
.pyq-subject-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  margin-bottom: 20px;
}

@media (max-width: 360px) {
  .pyq-subject-grid { grid-template-columns: repeat(2, 1fr); }
}

.pyq-subj-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: 16px;
  background: #ffffff;
  border: 1.5px solid #e8ecf5;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  box-shadow:
    3px 3px 8px rgba(71,64,196,0.06),
    -2px -2px 6px rgba(255,255,255,0.9);
}

.pyq-subj-card:active {
  transform: scale(0.94);
}

.pyq-subj-card.pyq-subj-disabled {
  opacity: 0.42;
  filter: grayscale(0.5) blur(0.3px);
  cursor: not-allowed;
  pointer-events: none;
}

/* SELECTED STATE — neumorphic pressed */
.pyq-subj-card.pyq-subj-selected {
  border-color: #a8a5f5;
  background: #f0f0ff;
  box-shadow:
    inset 3px 3px 8px rgba(91,92,246,0.14),
    inset -2px -2px 5px rgba(255,255,255,0.7);
  transform: scale(0.97) translateY(1px);
}

.pyq-subj-number {
  font-size: 12px;
  font-weight: 800;
  color: #94a3b8;
  background: #f1f5f9;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.pyq-subj-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform 0.22s;
}

.pyq-subj-card:hover:not(.pyq-subj-disabled) .pyq-subj-icon {
  transform: scale(1.08);
}

.pyq-subj-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--pyq-text);
  text-align: center;
  font-family: var(--pyq-font);
}
.pyq-subj-card.pyq-subj-selected .pyq-subj-label {
  color: var(--pyq-primary);
}

.pyq-subj-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pyq-primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(91,92,246,0.4);
}

/* ── Chapter Section ────────────────────────────────────────────── */
.pyq-chapter-section {
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  margin-bottom: 16px;
}

.pyq-chapter-section.pyq-chapter-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* ── Custom Dropdown ────────────────────────────────────────────── */
.pyq-dropdown-wrap {
  position: relative;
  width: 100%;
}

.pyq-dd-btn {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid #dde3f0;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--pyq-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--pyq-text);
  box-shadow: var(--pyq-shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.pyq-dd-btn:hover {
  border-color: #b8b5f5;
  box-shadow: 0 4px 12px rgba(91,92,246,0.1);
}

.pyq-dd-btn-text {
  flex: 1;
  text-align: left;
  font-size: 14px;
}

.pyq-dropdown-list {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1.5px solid #dde3f0;
  border-radius: 14px;
  box-shadow:
    0 8px 32px rgba(71,64,196,0.14),
    0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease;
  z-index: 100;
}

.pyq-dropdown-list.pyq-dd-open {
  max-height: 220px;
  opacity: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pyq-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--pyq-text);
  cursor: pointer;
  font-family: var(--pyq-font);
  border-bottom: 1px solid #f0f4fb;
  transition: background 0.14s;
}
.pyq-dd-item:last-child { border-bottom: none; }

.pyq-dd-item:hover { background: #f4f6ff; }

.pyq-dd-item.pyq-dd-selected {
  background: rgba(91,92,246,0.07);
  color: var(--pyq-primary);
  font-weight: 700;
}

.pyq-dd-tick {
  color: var(--pyq-primary);
  font-weight: 800;
  font-size: 15px;
}

/* ── Step 2 — Footer Row ────────────────────────────────────────── */
.pyq-s2-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding-top: 8px;
  flex-wrap: wrap;
}

.pyq-s2-footer-text {
  font-size: 12px;
  color: var(--pyq-muted);
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

/* ── Start Button ───────────────────────────────────────────────── */
.pyq-start-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #c5c4f5;
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--pyq-font);
  cursor: not-allowed;
  transition: all 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  opacity: 0.75;
  box-shadow: none;
  white-space: nowrap;
}

.pyq-start-btn.pyq-start-enabled {
  background: linear-gradient(135deg, var(--pyq-primary), var(--pyq-primary-2));
  cursor: pointer;
  opacity: 1;
  box-shadow: 0 6px 20px rgba(91,92,246,0.35);
}

.pyq-start-btn.pyq-start-enabled:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(91,92,246,0.25);
}

.pyq-start-btn.pyq-start-enabled:hover {
  box-shadow: 0 8px 28px rgba(91,92,246,0.45);
  transform: translateY(-1px);
}

/* ── Step Slide Animations ──────────────────────────────────────── */
@keyframes pyqSlideOutUp {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-24px); }
}

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

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

@keyframes pyqSlideInUp {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pyq-slide-out-up   { animation: pyqSlideOutUp   0.26s ease forwards; }
.pyq-slide-in-down  { animation: pyqSlideInDown  0.32s cubic-bezier(0.34,1.44,0.64,1) both; }
.pyq-slide-out-down { animation: pyqSlideOutDown 0.26s ease forwards; }
.pyq-slide-in-up    { animation: pyqSlideInUp    0.32s cubic-bezier(0.34,1.44,0.64,1) both; }

/* ── Scrollbar Styling ──────────────────────────────────────────── */
.pyq-step::-webkit-scrollbar,
.pyq-dropdown-list::-webkit-scrollbar { width: 4px; }
.pyq-step::-webkit-scrollbar-track,
.pyq-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.pyq-step::-webkit-scrollbar-thumb,
.pyq-dropdown-list::-webkit-scrollbar-thumb {
  background: #dde3f0;
  border-radius: 4px;
}

/* ── Touch / Mobile Enhancements ────────────────────────────────── */
@media (max-width: 480px) {
  .pyq-modal-card { border-radius: 20px; }
  .pyq-step { padding: 30px 20px 22px; }
  .pyq-brand-title { font-size: 26px; }
  .pyq-s2-footer { flex-direction: column; align-items: flex-start; }
  .pyq-start-btn { width: 100%; justify-content: center; }
}

/* Prevent body scroll when modal open */
body.pyq-no-scroll { overflow: hidden; }
