/* ⚠️ MOBILE-FIRST: Base rules = mobile. Use @media(min-width: X) for desktop. Do NOT use @media(max-width) for layout.
   ==========================================
   COMPONENTS - Reusable UI Components
   ========================================== */

/* ==========================================
   LOADING SPINNER & TERMINAL
   ========================================== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-terminal {
  background: #F8FAFC;
  border: 1px dashed var(--brand-gold);
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.loading-terminal:has(.audit-skeleton) {
  flex-direction: column;
  align-items: stretch;
}

.loading-terminal .spinner {
  border: 2px solid rgba(29, 45, 68, 0.2);
  border-top-color: var(--brand-navy);
}

.loading-text {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--brand-navy);
  font-weight: 600;
}

/* Fake Build Loader (Psychological) */
.fake-build-loader {
  background: var(--brand-navy);
  color: white;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  margin: 40px 0;
  box-shadow: 0 10px 30px rgba(29, 45, 68, 0.2);
}

.fake-build-loader .spinner {
  width: 40px;
  height: 40px;
  border-width: 4px;
  margin-bottom: 20px;
}

.fake-build-loader h3 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.fake-build-loader p {
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--brand-gold-light);
}

/* ==========================================
   TOPBAR / NAVIGATION
   ========================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 241, 234, 0.95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(29, 45, 68, 0.1);
  height: var(--topbar-height);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 1rem;
  text-decoration: none;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

@media(min-width: 640px) {
  .logo {
    font-size: 1.2rem;
    gap: 8px;
  }
}

.logo-text-navy { color: var(--brand-navy); }
.logo-text-gold { color: var(--brand-gold); }

.topbar-nav {
  display: none;
  align-items: center;
  gap: 1.2rem;
}

@media(min-width: 768px) {
  .topbar-nav { 
    display: flex; 
    gap: 1.8rem;
  }
}

.topbar-nav a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
  padding: 8px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.topbar-nav a:hover {
  color: var(--brand-navy);
}

.topbar-btn {
  background: var(--brand-navy);
  color: var(--card-bg);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(29, 45, 68, 0.15);
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

@media(min-width: 640px) {
  .topbar-btn {
    font-size: 0.75rem;
    padding: 0.6rem 1.2rem;
  }
}

.topbar-btn:hover {
  background: var(--brand-navy-light);
  transform: translateY(-1px);
}

/* --- Reset Progress Button (testing only) --- */
#btn-reset-progress {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#btn-reset-progress:hover {
  color: var(--error-red);
  border-color: var(--error-red);
  background: rgba(230, 57, 70, 0.06);
}

/* Production: add style="display:none" to the button element before Netlify deploy */

/* ==========================================
   BUTTONS
   ========================================== */
.cta-hero {
  display: block;
  background: var(--brand-navy);
  color: var(--card-bg);
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(29, 45, 68, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  line-height: 1.3;
  width: 100%;
  min-height: 44px;
}

@media(min-width: 640px) {
  .cta-hero {
    display: inline-block;
    width: auto;
    padding: 1.2rem 2.2rem;
    font-size: 1.05rem;
  }
}

.cta-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(29, 45, 68, 0.3);
}

.cta-hero small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.8;
  margin-top: 4px;
}

/* App Buttons */
.app-btn-primary {
  background: var(--brand-navy);
  color: var(--card-bg);
  border: none;
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(29, 45, 68, 0.15);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-btn-primary:hover:not(:disabled) {
  background: var(--brand-navy-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(29, 45, 68, 0.25);
}

.app-btn-primary:disabled {
  background: #E2E8F0;
  color: #94A3B8;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.app-btn-success {
  background: var(--success-green);
  color: var(--card-bg);
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media(min-width: 640px) {
  .app-btn-success {
    width: auto;
  }
}

.app-btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

/* ==========================================
   AUTH BUTTONS (Google Sign-In)
   ========================================== */
.btn-auth-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: var(--brand-navy);
  color: var(--card-bg);
  border: none;
  border-radius: 10px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(29, 45, 68, 0.2);
  min-height: 44px;
  text-decoration: none;
}

.btn-auth-google:hover {
  background: var(--brand-navy-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(29, 45, 68, 0.3);
}

.btn-auth-google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: white;
  color: #4285F4;
  border-radius: 4px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

/* ==========================================
   FORMS
   ========================================== */
.app-label {
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

.app-input,
.app-select,
.app-textarea {
  background: var(--card-bg);
  border: 1px solid #CBD5E1;
  color: var(--text-main);
  border-radius: 8px;
  padding: 12px;
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  transition: border 0.3s, box-shadow 0.3s;
  margin-bottom: 15px;
  min-height: 44px;
}

.app-input:focus,
.app-select:focus,
.app-textarea:focus {
  outline: none;
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(175, 144, 91, 0.1);
}

.app-input::placeholder,
.app-textarea::placeholder {
  color: #94A3B8;
}

.app-status {
  font-size: 0.85rem;
  color: var(--brand-navy);
  margin-top: 10px;
  font-family: monospace;
  font-weight: 600;
}

/* ==========================================
   CARDS
   ========================================== */
.app-card {
  background: var(--bg-cream);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.2rem;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

@media(min-width: 640px) {
  .app-card { padding: 1.5rem; }
}

@media(min-width: 768px) {
  .app-card { padding: 2rem; }
}

.app-card h3 {
  color: var(--brand-navy);
  font-family: var(--sans);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

@media(min-width: 640px) {
  .app-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
  }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
/* Mobile: show immediately without animation to avoid invisible flash/glitches */
.h-s1,
.h-s2,
.h-s3,
.h-s4,
.h-s5 {
  opacity: 1;
  transform: none;
}

@media(min-width: 768px) {
  .h-s1 { animation: riseIn 0.7s 0.05s both; }
  .h-s2 { animation: riseIn 0.7s 0.2s both; }
  .h-s3 { animation: riseIn 0.7s 0.38s both; }
  .h-s4 { animation: riseIn 0.7s 0.55s both; }
  .h-s5 { animation: riseIn 0.7s 0.72s both; }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* .rev elements are now visible immediately — the JS that adds .in class was missing */
.rev {
  opacity: 1;
  transform: translateY(0);
}

.rev-d1 { }
.rev-d2 { }
.rev-d3 { }

/* ==========================================
   MODALS
   ========================================== */
.custom-details {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.custom-details summary {
  background: #F8FAFC;
  padding: 16px;
  font-weight: 700;
  color: var(--brand-navy);
  cursor: pointer;
  outline: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  min-height: 44px;
}

.custom-details summary::-webkit-details-marker {
  display: none;
}

.custom-details summary::after {
  content: '▼';
  font-size: 10px;
  transition: transform 0.3s;
  color: var(--text-muted);
}

.custom-details[open] summary::after {
  transform: rotate(180deg);
}

.custom-details .details-content {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

/* ==========================================
   BADGES
   ========================================== */
.app-badge {
  display: inline-block;
  background: #F1F5F9;
  color: var(--brand-navy);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin: 0 6px 6px 0;
  border: 1px solid var(--border-light);
  font-weight: 600;
}

.app-badge.jd-badge {
  background: #FEF9C3;
  color: #854D0E;
  border-color: #FDE047;
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
  background: var(--brand-navy);
  padding: clamp(40px, 6vw, 60px) var(--pad);
  border-top: 1px solid rgba(0,0,0,0.1);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

@media(min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-brand {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.7;
}

.footer-brand strong {
  color: var(--brand-gold-light);
  font-size: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.8rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--card-bg);
}

/* ==========================================
   FEEDBACK GATE
   ========================================== */
.feedback-gate {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  margin-top: 20px;
  border: 2px solid var(--brand-gold);
  text-align: center;
  box-shadow: 0 10px 30px rgba(175, 144, 91, 0.1);
}

.star-rating {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 32px;
  cursor: pointer;
  justify-content: center;
}

.star {
  color: #E2E8F0;
  transition: color 0.2s;
}

.star:hover,
.star.active {
  color: #F59E0B;
}

/* ==========================================
   MOBILE RECOVERY BUTTON
   ========================================== */
.mobile-recover-btn {
  display: block;
  text-align: center;
  padding: 10px 14px;
  background: rgba(175, 144, 91, 0.08);
  border-bottom: 1px solid rgba(175, 144, 91, 0.15);
}

.mobile-recover-btn a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-gold) !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
}

.mobile-recover-btn a svg {
  stroke: var(--brand-gold);
  flex-shrink: 0;
}

.mobile-recover-btn a:hover,
.mobile-recover-btn a:active,
.mobile-recover-btn a:visited {
  color: var(--brand-gold-light) !important;
  text-decoration: none !important;
}

@media(min-width: 768px) {
  .mobile-recover-btn {
    display: none;
  }
}

/* ==========================================
   MOBILE SPACING IMPROVEMENTS
   ========================================== */
/* NOTE: Hero mobile styles are now in sections.css using mobile-first approach.
   Keep only component-level mobile overrides here. */

/* Card padding */
.app-card {
  padding: 1.2rem;
  margin-bottom: 16px;
}

@media(min-width: 640px) {
  .app-card {
    padding: 1.5rem;
  }
}

@media(min-width: 768px) {
  .app-card {
    padding: 2rem;
  }
}

/* Question blocks */
.question-block {
  padding: 14px;
  margin-bottom: 12px;
}

@media(min-width: 640px) {
  .question-block {
    padding: 18px;
    margin-bottom: 15px;
  }
}


.skeleton-loading-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: #F8FAFC;
  border: 1px dashed var(--brand-gold);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-navy);
}

.skeleton-loading-header .spinner {
  border-color: rgba(175,144,91,0.25);
  border-top-color: var(--brand-gold);
  width: 18px;
  height: 18px;
}
