/* ── AUTH PAGES ── */
.auth-page {
  padding: 120px 0 80px;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg) 60%);
  display: flex;
  align-items: center;
}

.auth-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 8px;
  text-align: center;
}

.auth-card .auth-subtitle {
  color: var(--text-secondary);
  font-size: .95rem;
  text-align: center;
  margin-bottom: 32px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 114, 12, .12);
}

.form-input.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .1);
}

.form-error {
  display: none;
  font-size: .82rem;
  color: #dc2626;
  margin-top: 2px;
}

.form-error.visible {
  display: block;
}

.auth-error {
  display: none;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: #dc2626;
  font-size: .88rem;
  text-align: center;
}

.auth-error.visible {
  display: block;
}

.auth-success {
  display: none;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  color: #16a34a;
  font-size: .88rem;
  text-align: center;
}

.auth-success.visible {
  display: block;
}

.auth-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  margin-top: 8px;
}

.auth-submit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232,114,12,.35);
}

.auth-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: .9rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
}

.auth-footer a:hover {
  color: var(--primary-dark);
}

/* ── TAB SWITCHER ── */
.auth-tabs {
  display: flex;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  font-size: .92rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-tab:not(.active):hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── NAV AUTH ── */
.nav-user-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--primary-light);
  border-radius: 100px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--primary) !important;
  transition: all var(--transition);
}

.nav-user-link:hover {
  background: rgba(232,114,12,.15);
}

.nav-user-avatar {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
}

.nav-user-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── DASHBOARD ── */
.dashboard-page {
  padding: 100px 0 80px;
  min-height: 100vh;
  background: var(--bg-alt);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.dashboard-header .user-greeting {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.btn-logout {
  padding: 10px 20px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover {
  border-color: #dc2626;
  color: #dc2626;
}

/* Stats Cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-card-label {
  font-size: .82rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 4px;
}

/* Recent Results Table */
.dashboard-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
}

.dashboard-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
}

.results-table td {
  padding: 14px 12px;
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.results-table tr:last-child td { border-bottom: none; }

.results-table tr:hover td { background: var(--primary-light); }

.net-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .82rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
}

/* Section Breakdown */
.section-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.section-stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.section-stat-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.section-stat-name {
  font-size: .85rem;
  font-weight: 600;
}

.section-stat-net {
  font-size: .95rem;
  font-weight: 800;
  color: var(--primary);
}

/* Empty State */
.dashboard-empty {
  text-align: center;
  padding: 60px 20px;
}

.dashboard-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.dashboard-empty h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dashboard-empty p {
  color: var(--text-secondary);
  font-size: .92rem;
  margin-bottom: 24px;
}

/* Loading spinner */
.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

/* Progress chart bars */
.progress-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 12px 0;
}

.progress-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.progress-bar-fill {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(180deg, var(--primary), #f0a060);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height .5s ease;
}

.progress-bar-label {
  font-size: .68rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.progress-bar-value {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text);
}

/* Purchase Status */
.purchase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.purchase-header h2 {
  margin-bottom: 0;
}

.btn-purchase-exam {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition);
}

.btn-purchase-exam:hover {
  background: rgba(232, 114, 12, .15);
}

.purchase-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.purchase-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.purchase-item:hover {
  border-color: #d4c5b5;
}

.purchase-item-all {
  border-color: var(--primary);
  background: rgba(232, 114, 12, .03);
}

.purchase-item-locked {
  opacity: .6;
}

.purchase-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.purchase-item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.purchase-icon-all {
  background: linear-gradient(135deg, #e8720c, #d4650a);
  color: #fff;
}

.purchase-icon-locked {
  background: #f1f1f1;
  color: #999;
}

.purchase-item-name {
  font-size: .92rem;
  font-weight: 700;
}

.purchase-item-detail {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.purchase-badge {
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

.purchase-badge-active {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.purchase-badge-buy {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(232, 114, 12, .2);
  text-decoration: none;
  transition: background var(--transition);
}

.purchase-badge-buy:hover {
  background: rgba(232, 114, 12, .15);
}

.purchase-no-items {
  text-align: center;
  padding: 24px 0;
  color: var(--text-secondary);
  font-size: .92rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .auth-card {
    padding: 32px 24px;
    margin: 0 16px;
  }
  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .section-breakdown {
    grid-template-columns: 1fr;
  }
  .dashboard-section {
    padding: 20px;
  }
  .results-table {
    font-size: .82rem;
  }
  .results-table th, .results-table td {
    padding: 10px 8px;
  }
  .purchase-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
  }
  .auth-card h1 {
    font-size: 1.5rem;
  }
  .dashboard-header h1 {
    font-size: 1.4rem;
  }
  .stats-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 16px;
  }
  .stat-card-value {
    font-size: 1.5rem;
  }
}
