/* ------------------------------------------------------------- */
/* UI COMPONENTS: CARDS, TABLES, BUTTONS, BADGES, TOASTS         */
/* ------------------------------------------------------------- */

/* Card System */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Table System */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--bg-table-header);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Buttons */
.btn {
  height: 36px;
  padding: 0 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  flex-shrink: 0;
  line-height: 1;
}

.btn-primary {
  background: var(--brand-blue, #2563EB);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--brand-blue-hover, #1D4ED8);
}

.btn-outline {
  background: var(--bg-card, #FFFFFF);
  border-color: var(--border-color, #CBD5E1);
  color: var(--text-main, #334155);
}

.btn-outline:hover {
  background: var(--bg-subtle, #F8FAFC);
  border-color: var(--brand-blue, #2563EB);
}

.btn-upgrade {
  background: linear-gradient(135deg, #7C3AED, #2563EB);
  color: #FFFFFF;
  border: none;
}

.btn-upgrade:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Theme Toggle Switch */
.btn-theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--brand-blue);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  box-sizing: border-box;
}

.btn-theme-toggle:hover {
  background: var(--bg-subtle);
  border-color: var(--brand-blue);
  transform: scale(1.05);
}

.btn-theme-toggle svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

[data-theme="dark"] .sun-icon { display: block !important; stroke: #F59E0B; }
[data-theme="dark"] .moon-icon { display: none !important; }
[data-theme="light"] .sun-icon { display: none !important; }
[data-theme="light"] .moon-icon { display: block !important; stroke: var(--brand-blue); }

/* Badges */
.badge-verified {
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--badge-blue-border);
  white-space: nowrap;
}

.badge-plan {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  line-height: 1.2;
}

.badge-plan-tier-1 {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #CBD5E1;
}

.badge-plan-tier-2 {
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  border: 1px solid var(--badge-blue-border);
}

.badge-plan-tier-3 {
  background: #EDE9FE;
  color: #6D28D9;
  border: 1px solid #DDD6FE;
}

[data-theme="dark"] .badge-plan-tier-1 {
  background: rgba(148, 163, 184, 0.15);
  color: #CBD5E1;
  border-color: #334155;
}

[data-theme="dark"] .badge-plan-tier-3 {
  background: rgba(168, 85, 247, 0.18);
  color: #D8B4FE;
  border-color: rgba(168, 85, 247, 0.35);
}

/* Status Pill Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-status-live {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.badge-status-announced {
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  border: 1px solid var(--badge-blue-border);
}

.badge-status-released {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-status-active {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

[data-theme="dark"] .badge-status-live {
  background: rgba(34, 197, 94, 0.18);
  color: #86EFAC;
  border-color: rgba(34, 197, 94, 0.35);
}

[data-theme="dark"] .badge-status-released {
  background: rgba(245, 158, 11, 0.18);
  color: #FDE68A;
  border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .badge-status-active {
  background: rgba(148, 163, 184, 0.18);
  color: #CBD5E1;
  border-color: rgba(148, 163, 184, 0.35);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: currentColor;
  border-radius: 50%;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}

/* Scorecard Visuals */
.score-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--brand-blue);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

/* Toast Notifications */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0F172A;
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  z-index: 20000 !important;
  display: none;
  align-items: center;
  gap: 0.5rem;
  border-left: 4px solid var(--brand-blue);
  animation: toastSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlide {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ------------------------------------------------------------- */
/* TEST SERIES LIBRARY & CARDS SYSTEM                            */
/* ------------------------------------------------------------- */

.test-library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.test-progress-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(248, 250, 252, 0.9) 100%);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .test-progress-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(15, 23, 42, 0.9) 100%);
  border-color: rgba(37, 99, 235, 0.3);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: #E2E8F0;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

[data-theme="dark"] .progress-bar-track {
  background: #334155;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB, #10B981);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.filter-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.filter-chips-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-chip svg {
  stroke: #2563EB;
  color: #2563EB;
  flex-shrink: 0;
  transition: stroke 0.15s ease, fill 0.15s ease;
}

.filter-chip:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.filter-chip.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #FFFFFF;
}

.filter-chip.active svg {
  stroke: #FFFFFF !important;
  color: #FFFFFF !important;
}

.filter-chip.active svg[fill="#2563EB"] {
  fill: #FFFFFF !important;
  stroke: #FFFFFF !important;
}

.filter-dropdowns-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-dropdowns-row select {
  height: 38px;
  padding: 0 2.25rem 0 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232563EB' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px 14px;
  color: var(--brand-blue);
  font-size: 0.85rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  max-width: none !important;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.filter-dropdowns-row select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.filter-dropdowns-row select:hover {
  border-color: var(--brand-blue);
}

.filter-dropdowns-row select option {
  background-color: var(--bg-card);
  color: var(--text-main);
  font-weight: 500;
}

[data-theme="dark"] .filter-dropdowns-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2360A5FA' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.search-input-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 1rem 0 2.2rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-icon-fixed {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  stroke: #2563EB !important;
}

.test-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.test-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: transform 0.15s ease;
  color: #2563EB;
}

.star-btn svg {
  stroke: #2563EB;
  color: #2563EB;
}

.star-btn:hover {
  transform: scale(1.2);
}

.star-btn.starred svg {
  fill: #2563EB;
  stroke: #2563EB;
}

.attempt-status-box {
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 10px 0;
}

[data-theme="dark"] .attempt-status-box {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.locked-card-overlay {
  opacity: 0.85;
}

/* Mobile palette drawer hidden by default on desktop */
.mobile-palette-drawer-backdrop {
  display: none;
}

