/* assets/css/style.css */
/* QuizMaster Pro — Global Styles */
/* Mobile-first, pure CSS, no frameworks */

/* ===== CSS VARIABLES ===== */
:root {
  --bg:          #F4F6FF;
  --surface:     #FFFFFF;
  --surface2:    #EEF2FF;
  --border:      #E2E6F3;
  --border2:     #C7D0EE;
  --accent:      #4F46E5;
  --accent-dk:   #4338CA;
  --accent-lt:   #EEF2FF;
  --accent-mid:  #818CF8;
  --text1:       #1E1B4B;
  --text2:       #4B5280;
  --text3:       #9CA3AF;
  --ok-bg:       #D1FAE5;
  --ok-txt:      #065F46;
  --err-bg:      #FEE2E2;
  --err-txt:     #991B1B;
  --warn-bg:     #FEF3C7;
  --warn-txt:    #92400E;
  --shadow:      0 1px 4px rgba(79,70,229,.08);
  --shadow-md:   0 4px 16px rgba(79,70,229,.12);
  --r-sm:        8px;
  --r-md:        12px;
  --r-lg:        16px;
  --r-xl:        24px;
  --nav-h:       62px;
  --container:   1100px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text1);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ===== LAYOUT ===== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

.main-content {
  flex: 1;
  padding-top: var(--nav-h);
  padding-bottom: 3rem;
}

/* ===== NAVIGATION ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon { flex-shrink: 0; }

.logo-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text1);
  letter-spacing: -0.3px;
}
.logo-text strong { color: var(--accent); font-weight: 800; }

.nav-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text2);
  transition: background .15s;
}
.nav-hamburger:hover { background: var(--surface2); }

.nav-links {
  display: none;
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-md);
}

.nav-links.open { display: flex; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  transition: all .15s;
}

.nav-link:hover {
  background: var(--surface2);
  color: var(--accent);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
}

.nav-link-cta {
  background: var(--accent);
  color: #fff !important;
}
.nav-link-cta:hover {
  background: var(--accent-dk) !important;
  color: #fff !important;
}

.nav-link-quiz {
  color: var(--accent);
  background: var(--accent-lt);
}
.nav-link-quiz:hover {
  background: var(--accent);
  color: #fff !important;
}

.nav-link-logout {
  color: var(--err-txt);
}
.nav-link-logout:hover {
  background: var(--err-bg);
  color: var(--err-txt) !important;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text1);
  margin-bottom: 0.5rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  border: none;
  transition: all .15s;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
  text-decoration: none;
  color: #fff;
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: var(--surface);
  border: 1.5px solid var(--border2);
  color: var(--text1);
}
.btn-outline:hover {
  background: var(--surface2);
  text-decoration: none;
  color: var(--text1);
}

.btn-danger {
  background: #EF4444;
  color: #fff;
}
.btn-danger:hover {
  background: #DC2626;
  color: #fff;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--text1);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  min-height: 44px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.form-control::placeholder { color: var(--text3); }

.form-control.is-error { border-color: #EF4444; }

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 1rem;
}

.alert-error {
  background: var(--err-bg);
  color: var(--err-txt);
  border: 1px solid #FCA5A5;
}

.alert-success {
  background: var(--ok-bg);
  color: var(--ok-txt);
  border: 1px solid #6EE7B7;
}

.alert-warning {
  background: var(--warn-bg);
  color: var(--warn-txt);
  border: 1px solid #FCD34D;
}

.alert-info {
  background: var(--accent-lt);
  color: var(--accent);
  border: 1px solid var(--border2);
}

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

.badge-primary { background: var(--accent-lt); color: var(--accent); }
.badge-success { background: var(--ok-bg);     color: var(--ok-txt); }
.badge-error   { background: var(--err-bg);    color: var(--err-txt); }
.badge-warning { background: var(--warn-bg);   color: var(--warn-txt); }
.badge-neutral { background: var(--surface2);  color: var(--text2); }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text3);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text1);
  letter-spacing: -0.8px;
  line-height: 1;
}

.stat-value.accent { color: var(--accent); }
.stat-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--surface2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td strong { color: var(--text1); font-weight: 600; }

/* ===== PAGE HEADER ===== */
.page-header {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #fff;
  padding: 2.5rem 0 2rem;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 0.25rem;
}

.page-header p { opacity: 0.85; font-size: 15px; }

/* ===== SECTION HEADINGS ===== */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text1);
  letter-spacing: -0.3px;
  margin-bottom: 1rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text3);
}

.empty-state svg { margin: 0 auto 1rem; }
.empty-state h3 { font-size: 1rem; color: var(--text2); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 14px; }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--text1);
  color: rgba(255,255,255,0.6);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 0.5rem;
}

.footer-tagline { font-size: 13px; margin-bottom: 1rem; }

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.footer-nav a {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  text-decoration: none;
  transition: color .15s;
}
.footer-nav a:hover { color: #fff; }

.footer-copy { font-size: 12px; }

/* ===== HERO (Home page) ===== */
.hero {
  padding: 3rem 0 4rem;
  text-align: center;
}

.hero h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text1);
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero h1 span { color: var(--accent); }

.hero p {
  font-size: 16px;
  color: var(--text2);
  max-width: 520px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.hero-features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 3rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  text-align: left;
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-lt);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--accent);
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text1);
  margin-bottom: 0.4rem;
}

.feature-card p {
  font-size: 14px;
  color: var(--text2);
}

/* ===== SPINNER ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.fw-bold { font-weight: 700; }
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent); }
.small { font-size: 13px; }

/* ===== MOBILE TOUCH OPTIMIZATIONS ===== */
@media (max-width: 768px) {
  button,
  a,
  input[type="button"],
  input[type="submit"],
  .btn,
  [role="button"] {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }
}

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .hero h1 { font-size: 30px; }
  .hero-actions { flex-direction: row; justify-content: center; }
}

@media (min-width: 640px) {
  .container { padding: 0 24px; }
  .nav-hamburger { display: none; }
  .nav-links {
    display: flex !important;
    position: static;
    border: none;
    padding: 0;
    flex-direction: row;
    gap: 4px;
    box-shadow: none;
    background: transparent;
  }
  .hero-features { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .hero h1 { font-size: 38px; }
  .hero { padding: 5rem 0 6rem; }
  .hero-features { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .container { padding: 0 32px; }
}
