/* UCB-iQuiz PWA Design System - White & Orange Theme */
:root {
  --bg-app: #ffffff;
  --bg-surface: #fffdfa;
  --bg-card: #ffffff;
  --bg-card-hover: #fff7ed;
  --bg-input: #ffffff;
  
  --border-light: #ffedd5;
  --border-active: #f97316;
  
  --primary-orange: #f97316;
  --primary-orange-hover: #ea580c;
  --secondary-orange: #ffedd5;
  --secondary-orange-hover: #fed7aa;
  --light-orange-bg: #fff7ed;
  
  --text-main: #1c1917;
  --text-sub: #44403c;
  --text-muted: #78716c;
  
  --emerald-600: #059669;
  --rose-600: #e11d48;
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --shadow-card: 0 4px 20px -2px rgba(249, 115, 22, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.2);
  
  --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bottom-nav-height: 68px;
  --top-bar-height: 64px;
}

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

input, button, textarea, select {
  user-select: text;
}

html, body {
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Viewport Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  background-color: var(--bg-app);
}

/* App Header / Top Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--top-bar-height);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-orange), #ff8c00);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.4px;
  color: var(--primary-orange);
}

.header-user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--secondary-orange);
  border: 1px solid var(--border-light);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary-orange);
  text-decoration: none;
}

.header-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 900;
}

/* App Main Body */
.app-body {
  flex: 1;
  padding: 1.25rem 1rem calc(var(--bottom-nav-height) + 1.5rem) 1rem;
  max-width: 100%;
}

@media (min-width: 768px) {
  .app-body {
    padding-bottom: 2rem;
  }
}

/* PWA App Cards */
.app-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.app-card:active {
  transform: scale(0.99);
}

/* Wallet Banner Widget */
.wallet-widget {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 25px -5px rgba(249, 115, 22, 0.15);
}

.wallet-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.wallet-amount {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--primary-orange);
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
}

.wallet-stats-row {
  display: flex;
  gap: 1.5rem;
  border-top: 1px solid #fed7aa;
  padding-top: 0.75rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-item .val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.stat-item .lbl {
  font-size: 0.725rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Plan Badges */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-bronze { background: #ffedd5; color: #ea580c; border: 1px solid #fed7aa; }
.badge-silver { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-gold { background: var(--secondary-orange); color: var(--primary-orange); border: 1px solid var(--border-light); }
.badge-platinum { background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; }
.badge-diamond { background: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }

/* Touch Buttons */
.btn-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.btn-app-orange {
  background: linear-gradient(135deg, var(--primary-orange), var(--primary-orange-hover));
  color: #ffffff;
}

.btn-app-orange:active {
  transform: scale(0.98);
}

.btn-app-secondary {
  background: var(--secondary-orange);
  color: var(--primary-orange);
  border: 1px solid #fed7aa;
}

.btn-app-secondary:active {
  background: #fed7aa;
  transform: scale(0.98);
}

/* Forms */
.app-form-group {
  margin-bottom: 1.1rem;
}

.app-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-sub);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.app-form-input, .input-app, .form-control {
  width: 100%;
  box-sizing: border-box;
  padding: 0.95rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s ease;
  display: block;
  min-height: 48px;
}

select.app-form-input, select.input-app, select.form-control {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  background-color: #ffffff;
}

select.app-form-input option, select.input-app option, select.form-control option {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  padding: 0.5rem;
}

.app-form-input:focus, .input-app:focus, .form-control:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* Bottom Navigation Bar (PWA Mobile App Experience) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 800;
  gap: 0.25rem;
  flex: 1;
  height: 100%;
  transition: color 0.2s ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-muted);
  transition: stroke 0.2s ease, transform 0.2s ease;
}

.nav-item.active {
  color: var(--primary-orange);
}

.nav-item.active svg {
  stroke: var(--primary-orange);
  transform: translateY(-2px);
}

/* Floating Center Action Button for Quiz */
.nav-fab-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  top: -12px;
  text-decoration: none;
  z-index: 10;
}

.nav-fab-quiz {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.45);
  border: 3px solid #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-fab-quiz svg {
  width: 24px;
  height: 24px;
  stroke: #ffffff !important;
}

.nav-fab-wrapper span {
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--primary-orange);
  margin-top: 2px;
}

.nav-fab-wrapper:active .nav-fab-quiz {
  transform: scale(0.92);
}

/* Mobile Center Frame for Auth Pages */
.auth-frame {
  max-width: 420px;
  margin: 1.5rem auto;
  padding: 0 0.5rem;
}

/* Modal Popup Dialog System (Replaces browser alert/banner boxes) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid var(--border-light);
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-icon-badge {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin: 0 auto 1rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.modal-icon-info { background: var(--secondary-orange); color: var(--primary-orange); }
.modal-icon-success { background: #dcfce7; color: var(--emerald-600); }
.modal-icon-error { background: #ffe4e6; color: var(--rose-600); }

.modal-title {
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.modal-body-text {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.modal-close-btn {
  background: var(--primary-orange);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}
