/* ==========================================================================
   TESTS HUB - Listing Page Styles
   Uses variables from variables.css (imported via main.css)
   ========================================================================== */

/* ========== FILTERS ========== */

.tests-filters {
  margin-bottom: var(--space-6);
}

.tests-filter-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Exam Filter Tabs */
.tests-filter-tabs-outer {
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;           /* clips the scrollable inner div at rounded corners */
}

.tests-filter-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 163, 175, 0.3) transparent;
}

.tests-filter-tabs::-webkit-scrollbar {
  height: 6px;
}

.tests-filter-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.tests-filter-tabs::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.3);
  border-radius: 3px;
}

.tests-filter-tabs::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.5);
}

.tests-filter-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.6rem var(--space-4);
  border: 1px solid var(--border-subtle);
  background: var(--bg-page);
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-xl);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.tests-filter-tab .lucide {
  width: 1rem;
  height: 1rem;
}

.tests-filter-tab:hover {
  background: var(--admin-active-bg);
  color: var(--text-main);
}

.tests-filter-tab.active {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
}

.tab-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
}

.tests-filter-tab:not(.active) .tab-count {
  background: var(--admin-active-bg);
  color: var(--text-main);
}

/* Row wrapper: dropdowns + search in one line on large screens */
.tests-filters-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

/* Type & Difficulty Dropdowns */
.tests-filter-dropdowns {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  justify-content: center;
  /* margin-bottom removed — parent row gap handles spacing */
}

.tests-filter-select {
  padding: 8px 36px 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: var(--fs-sm, 14px);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.tests-filter-select option {
  background: var(--bg-card);
  color: var(--text-main);
}

.tests-filter-select:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}



/* Search - Centered */
.filter-search {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: 560px;
}

.search-input-wrap {
  flex: 0 1 400px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 0.2s;
}

.search-input-wrap:focus-within {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.search-input-wrap .lucide {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: var(--fs-sm);
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  padding: 10px 20px;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition-base);
}

.clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--admin-active-bg);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: var(--text-main);
  transition: var(--transition-base);
}

.clear-btn:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-color: var(--color-error);
}

.clear-btn .lucide {
  width: 18px;
  height: 18px;
}

/* Results Info */
.results-info {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin-bottom: var(--space-4);
}

/* ========== TEST CARDS GRID ========== */

.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

/* Test Card */
.test-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-subtle);
  overflow: hidden;
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
}

.test-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--admin-hover-bg);
}

.test-card-locked {
  cursor: default;
}

.test-card-locked:hover {
  transform: none;
  border-color: var(--border-subtle);
  box-shadow: none;
}

/* Card Header - Two rows */
.test-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 0;
  gap: 8px;
}

.test-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.test-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Badges */
.tc-badge {
  padding: 3px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-align: center;
}

.tc-badge-type {
  background: var(--admin-hover-bg);
  color: var(--accent-primary);
}

.tc-badge-diff {
  text-transform: capitalize;
}

.tc-badge-diff-easy {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.tc-badge-diff-medium {
  background: var(--color-warning-bg);
  color: #b45309;
}

.tc-badge-diff-hard {
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* Card Body */
.test-card-title {
  padding: 12px 20px 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

.test-card-desc {
  padding: 6px 20px 0;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: 1.5;
}

/* Card Stats */
.test-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  margin-top: auto;
}

.tc-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-soft);
}

.tc-stat .lucide {
  width: 15px;
  height: 15px;
  color: #0ea5e9;
}

.tc-stat-neg {
  color: var(--color-error);
}

.tc-stat-attempts {
  color: var(--text-soft);
}

.tc-stat-attempts .lucide {
  color: #06b6d4;
}

/* Card Footer */
.test-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.tc-mode {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: var(--fw-semibold);
}

.tc-mode .lucide {
  width: 14px;
  height: 14px;
}

.tc-mode-free {
  color: #fff;
  background: var(--color-success);
  padding: 3px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.tc-mode-premium {
  color: #fff;
  background: var(--accent-gradient);
  padding: 3px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.tc-mode-premium-unlocked {
  color: var(--accent-secondary);
  background: var(--color-red-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 12px;
  text-transform: uppercase;
}

.tc-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  transition: gap 0.2s;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  padding: 3px 12px;
}

.test-card:hover .tc-cta {
  gap: 8px;
}

.tc-cta .lucide {
  width: 16px;
  height: 16px;
}


/* ========== PAGINATION ========== */

.tests-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-soft);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: all 0.2s;
}

.page-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.page-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.page-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

/* ========== EMPTY STATE ========== */

.tests-empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.tests-empty>.lucide {
  width: 4rem;
  height: 4rem;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.tests-empty h2 {
  font-size: var(--fs-3xl);
  color: var(--text-main);
  margin-bottom: var(--space-2);
}

.tests-empty p {
  color: var(--text-soft);
  margin-bottom: var(--space-6);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}



/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .tests-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .tests-filter-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .tests-filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .tests-filter-dropdowns {
    width: 100%;
    justify-content: center;
  }

  .tests-filter-select {
    flex: 1;
    min-width: 0;
  }

  .filter-search {
    flex: unset;
    width: 100%;
    justify-content: center;
    /* no flex-wrap: input + button stay in same row */
  }

  .search-input-wrap {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .test-card-header {
    align-items: flex-start;
  }

  .tc-stat {
    font-size: 12px;
  }
}

/* ========== LIVE TAB — in tests-filter-tabs ========== */

.tests-filter-tab--live {
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
  background: rgba(22, 163, 74, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tests-filter-tab--live:hover {
  background: rgba(22, 163, 74, 0.15);
  color: #15803d;
}

.tests-filter-tab--live .live-dot {
  background: #16a34a;
}

.tests-filter-tab--pyq {
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tests-filter-tab--pyq:hover {
  background: rgba(124, 58, 237, 0.15);
  color: #6d28d9;
}
.tests-filter-tab--pyq svg { width: 13px; height: 13px; }

/* ========== LIVE BADGE — on regular test cards ========== */

.tc-badge-live {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.test-card-live {
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.08);
}

/* Pulsing live dot — reused on /live page too */
.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #dc2626;
  border-radius: 50%;
  animation: live-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.75); }
}

/* ========== /live PAGE — Layout ========== */

.live-main {
  padding-top: var(--space-8);
  padding-bottom: var(--space-16);
}

.live-empty {
  margin-top: var(--space-10);
}

.live-empty-cta {
  margin-top: var(--space-4);
}

.live-submitted-main {
  padding-top: var(--space-12);
  padding-bottom: var(--space-16);
  max-width: 540px;
}

/* ========== /live PAGE — Live Tests Grid ========== */

.live-tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-2);
}

.live-test-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.live-test-card.live-status-live {
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.live-test-card.live-status-registration {
  border-color: rgba(59, 130, 246, 0.35);
}

.live-test-card.live-status-ended {
  opacity: .7;
}

.live-card-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.live-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.live-status-badge-upcoming    { background: var(--bg-section); color: var(--text-soft); }
.live-status-badge-registration { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.live-status-badge-live        { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.live-status-badge-ended       { background: var(--bg-section); color: var(--text-soft); }

.live-reg-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--admin-hover-bg);
  padding: 3px 8px;
}

.live-reg-count svg { width: 14px; height: 14px; }

.live-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.35;
}

.live-card-subtitle {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0;
}

.live-card-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.live-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.live-meta-item svg { width: 14px; height: 14px; flex-shrink: 0; }

.live-card-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.live-card-cta {
  margin-left: auto;
  padding: 7px 12px;
  font-size: 13px;
}

@media (max-width: 480px) {
  .live-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .live-card-cta {
    margin-left: 0;
    text-align: center;
    justify-content: center;
  }
  .live-reg-closed-badge {
    justify-content: center;
  }
}

.live-join-btn {
  background: var(--color-success);
  border-color: var(--color-success);
}

.live-join-btn:hover { background: #b91c1c; border-color: #b91c1c; }

.live-registered-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--success, #16a34a);
  font-weight: 600;
}

.live-registered-badge svg { width: 15px; height: 15px; }

.live-footer-note {
  font-size: 12px;
  color: var(--text-soft);
  margin: 0;
}

.live-timer-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-3);
}

.live-timer-label {
  font-size: 12px;
  color: var(--text-soft);
  flex-shrink: 0;
}

.live-timer {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  letter-spacing: 0.03em;
}

.live-status-badge-live .live-timer { color: #dc2626; }

.live-reg-closed-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--admin-active-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
}

.live-reg-closed-badge svg { width: 13px; height: 13px; }

.live-attempted-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 7px 12px;
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.live-attempted-badge svg { width: 15px; height: 15px; color: var(--success, #16a34a); }

/* ── Live Submitted Confirmation Page ── */
.live-submitted-icon {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.live-submitted-icon svg {
  width: 56px;
  height: 56px;
  color: #16a34a;
  stroke-width: 1.5;
}

.live-submitted-heading {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 var(--space-2);
}

.live-submitted-sub {
  text-align: center;
  font-size: 14px;
  color: var(--text-soft);
  margin: 0 0 var(--space-6);
}

.live-submitted-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}

.live-submitted-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.live-submitted-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.live-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.live-stat-label {
  font-size: 11px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.live-stat-correct .live-stat-value { color: #16a34a; }
.live-stat-wrong  .live-stat-value  { color: #dc2626; }

.live-submitted-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.live-score-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.live-score-denom {
  font-size: 18px;
  color: var(--text-soft);
  font-weight: 500;
}

.live-score-label {
  font-size: 13px;
  color: var(--text-soft);
  margin-left: 6px;
  align-self: center;
}

.live-submitted-announce {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  background: var(--bg-section);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
}

.live-submitted-announce svg { width: 15px; height: 15px; flex-shrink: 0; }

.live-submitted-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

@media (max-width: 480px) {
  .live-submitted-stats { grid-template-columns: repeat(2, 1fr); }
  .live-submitted-actions { flex-direction: column; }
  .live-tests-grid { grid-template-columns: 1fr; }
}