/* =========================================================
   MUST PSC — Global Styles
   Modern Design System
   ========================================================= */

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

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== DESIGN TOKENS ===== */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #eff6ff;
  --primary-xlight: #dbeafe;

  --success:       #16a34a;
  --success-light: #dcfce7;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;

  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --bar-low:  var(--danger);
  --bar-mid:  var(--warning);
  --bar-high: var(--success);

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  --ease: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== BODY ===== */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; color: var(--gray-900); }
h1 { font-size: clamp(22px, 4vw, 32px); }
h2 { font-size: clamp(18px, 3vw, 24px); }
h3 { font-size: 18px; }
p  { color: var(--gray-600); }

/* ===== HEADER ===== */
header {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 60%, #3b82f6 100%);
  color: #fff;
  padding: 0 20px;
  height: 64px;
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(37,99,235,0.30);
}

/* ===== FLOATING HOME SYMBOL (LEFT TOP) ===== */
.floating-home-symbol {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 250;

  /* Large, high‑contrast for blue header */
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  line-height: 1;

  /* Highlight on blue background */
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  padding: 8px 12px;

  /* Visibility + depth */
  box-shadow:
    0 4px 14px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.35);

  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.floating-home-symbol:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.30);
}

.site-header {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  position: relative;
}

.site-header span,
.site-header h1,
.site-header .title {
  font-size: 24px;              /* bigger, dominant */
  font-weight: 900;             /* extra bold */
  letter-spacing: 1.2px;        /* strong, authoritative spacing */
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 10px;

  /* Bold brand highlight */
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.28),
    rgba(255,255,255,0.10)
  );

  border: 1px solid rgba(255,255,255,0.35);

  /* Strong depth for brand feel */
  box-shadow:
    0 4px 18px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

.site-header .title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}

.auth-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  background: rgba(255,255,255,0.18);
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.25);
  transition: var(--ease);
  backdrop-filter: blur(4px);
}

.auth-btn:hover {
  background: rgba(255,255,255,0.30);
}

/* ===== CONTAINER ===== */
.container {
  max-width: 900px;
  margin: 28px auto 100px;
  padding: 0 16px;
}

/* ===== CARD ===== */
.card {
  background: #fff;
  padding: 20px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
  transition: box-shadow var(--ease), transform var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }

/* ===== BUTTONS ===== */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
  transform: translateY(-1px);
}

button:active, .button:active { transform: translateY(0); }

button.secondary,
.secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
}

button.secondary:hover,
.secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

button:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ===== INPUTS ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input:not([type]),
select {
  width: 100%;
  padding: 11px 14px;
  margin: 8px 0;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--gray-200);
  font-size: 15px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  outline: none;
}

input:hover, select:hover { border-color: var(--gray-300); }

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  background: #fff;
}

input::placeholder { color: var(--gray-400); }

/* ===== STATUS ===== */
.status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--gray-500);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.badge-blue   { background: var(--primary-xlight); color: var(--primary-dark); }
.badge-green  { background: var(--success-light);  color: var(--success); }
.badge-yellow { background: var(--warning-light);  color: var(--warning); }
.badge-red    { background: var(--danger-light);   color: var(--danger); }

/* ===== SUBJECT / TOPIC ===== */
.subject,
.topic {
  background: #fff;
  padding: 16px;
  border-radius: var(--r-md);
  margin-bottom: 10px;
  border: 1.5px solid var(--gray-200);
  cursor: pointer;
  transition: all var(--ease);
}

.subject:hover,
.topic:hover {
  background: var(--primary-light);
  border-color: var(--primary-xlight);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--gray-200);
  display: flex;
  z-index: 300;
  height: 72px;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.07);
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--gray-400);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--ease);
  min-height: 72px;
  font-size: 14px;
  padding: 10px 0;
  flex-direction: column;   /* stack icon above text */
  text-align: center;       /* center label */
  line-height: 1.1;         /* tighter two-line layout */
  white-space: normal;      /* allow wrapping if needed */
  word-break: break-word;   /* prevent overflow */
}

.bottom-nav a.active,
.bottom-nav a:hover { color: var(--primary); }











/* ===== PERFORMANCE BARS ===== */
.perf-bar-wrap { display: flex; align-items: center; gap: 12px; margin: 8px 0; }

.perf-bar-track {
  flex: 1;
  height: 10px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
}

.perf-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.perf-bar-fill.low  { background: var(--bar-low); }
.perf-bar-fill.mid  { background: var(--bar-mid); }
.perf-bar-fill.high { background: var(--bar-high); }

.perf-bar-label { font-size: 13px; font-weight: 600; min-width: 38px; text-align: right; }
.perf-bar-label.low  { color: var(--danger);  }
.perf-bar-label.mid  { color: var(--warning); }
.perf-bar-label.high { color: var(--success); }

/* ===== SKELETON LOADER ===== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-900);
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--gray-200); margin: 20px 0; }

/* ===== TYPOGRAPHY SCALE (Exam UI) ===== */
/* Subject: 16–17 px */
.mistakes-page .card {
  font-size: 16px;
  font-weight: 600;
}

/* Topic: 14–15 px */
.mistakes-page .topic {
  font-size: 15px;
  font-weight: 500;
}

/* Question: 17–19 px */
.attempt-page .question,
.mistakes-page .questionBox .question {
  font-size: 18px;
  font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {

  /* General layout */
  .container { padding: 0 12px; margin: 14px auto 90px; }

  header { height: 58px; }
  .site-header span,
  .site-header h1,
  .site-header .title { font-size: 18px; }

  .auth-btn { padding: 6px 10px; font-size: 13px; }

  /* Buttons & inputs (thumb friendly) */
  button, .button {
    font-size: 15px;
    padding: 12px 16px;
    border-radius: var(--r-md);
  }

  input, select {
    font-size: 16px; /* prevents iOS zoom */
    padding: 12px 14px;
  }

  /* Home stats → single column for readability */
  .page-home .stats-grid { grid-template-columns: 1fr; }

  .page-home .hero { padding: 26px 18px; }

  .page-home .last-test-box { font-size: 14px; }


  /* Mistake analyzer */
  .mistakes-page .questionBox { padding: 16px; }


  /* Profile page → stacked layout */
  .profile-page .row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .profile-page .label { min-width: unset; }

  /* Bottom nav touch targets */
  .bottom-nav { height: 72px; }

  .bottom-nav a {
    font-size: 14px;
    padding: 10px 0;
    min-height: 72px;
  }
}