/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #000;
  --surface: #09090b;
  --surface-2: #18181b;
  --border: #27272a;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #facc15;
  --accent-hover: #eab308;
  --accent-text: #09090b;
  --radius: 12px;
  --max-w: 42rem;
}

html.dark { color-scheme: dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
#app {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ---- Header ---- */
header {
  border-bottom: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(12px);
  padding: 1rem 0;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

@media (min-width: 640px) {
  .header-inner { padding: 0 1.5rem; }
}

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  h1 { font-size: 1.5rem; }
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ---- Main ---- */
main {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1rem;
}

@media (min-width: 640px) {
  main { padding: 3rem 1.5rem; }
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ---- Intro Text ---- */
.intro-text {
  font-size: 0.875rem;
  line-height: 1.625;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.intro-text strong {
  color: var(--text);
}

/* ---- Honeypot ---- */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
}

/* ---- Questions ---- */
.space-y-8 > * + * { margin-top: 2rem; }

fieldset {
  border: 0;
  padding: 0;
}

.question-label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.625;
  color: var(--text);
  margin-bottom: 0.75rem;
  display: block;
}

.hint {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ---- Rating Buttons ---- */
.rating-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .rating-group { gap: 0.75rem; }
}

.rating-btn {
  display: flex;
  min-height: 2.75rem;
  min-width: 2.75rem;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(24, 24, 27, 0.8);
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  user-select: none;
}

@media (min-width: 640px) {
  .rating-btn {
    min-width: 3.25rem;
  }
}

.rating-btn:hover {
  border-color: #52525b;
}

.rating-btn.selected {
  border-color: var(--accent);
  background: rgba(250, 204, 21, 0.1);
  color: var(--accent);
}

.rating-btn.selected span {
  color: var(--accent);
}

.rating-btn span {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Choice Buttons ---- */
.choice-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .choice-group {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.choice-btn {
  display: flex;
  min-height: 2.75rem;
  flex: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(24, 24, 27, 0.8);
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
}

@media (min-width: 640px) {
  .choice-btn { min-width: 7rem; }
}

.choice-btn:hover {
  border-color: #52525b;
}

.choice-btn.selected {
  border-color: var(--accent);
  background: rgba(250, 204, 21, 0.1);
  color: var(--accent);
}

/* ---- Textarea ---- */
.block { display: block; }

.textarea {
  width: 100%;
  min-height: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  resize: vertical;
  margin-top: 0.5rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.textarea::placeholder {
  color: var(--text-dim);
}

/* ---- Submit Button ---- */
.submit-btn {
  width: 100%;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .submit-btn {
    width: auto;
    min-width: 200px;
  }
}

.submit-btn:hover {
  background: var(--accent-hover);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Spinner ---- */
.btn-spinner { display: inline-flex; width: 1.25rem; height: 1.25rem; }
.spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Success ---- */
#successMessage {
  text-align: center;
  padding: 3rem 1rem;
}

.success-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1.5rem;
  font-weight: 700;
}

#successMessage h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

#successMessage p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.hidden { display: none !important; }

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  text-align: center;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-link {
  font-size: 0.75rem;
  color: rgba(250, 204, 21, 0.9);
  text-underline-offset: 2px;
}

.footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ======================================== */
/* DASHBOARD STYLES                        */
/* ======================================== */

/* ---- Login ---- */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 300px;
}

.input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.4);
}

.error-message {
  font-size: 0.75rem;
  color: #ef4444;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

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

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ---- Ready Bars ---- */
.ready-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ready-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ready-bar-label {
  font-size: 0.75rem;
  min-width: 6rem;
  color: var(--text-muted);
}

.ready-bar-track {
  flex: 1;
  height: 1.5rem;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.ready-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.ready-bar-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  min-width: 2rem;
  text-align: right;
}

/* ---- Table ---- */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.table-header .card-title {
  margin-bottom: 0;
}

.table-info {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

tbody tr:hover {
  background: var(--surface-2);
}

tbody tr:nth-child(even) {
  background: rgba(24, 24, 27, 0.5);
}

tbody tr:nth-child(even):hover {
  background: var(--surface-2);
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* ---- Action Buttons ---- */
.actions-card .card-title {
  margin-bottom: 1rem;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.action-btn:hover {
  border-color: #52525b;
  background: rgba(39, 39, 42, 0.8);
}

.action-btn svg {
  flex-shrink: 0;
}

.export-btn:hover {
  border-color: #22c55e;
  color: #22c55e;
}

.delete-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* ---- Confirm Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.modal p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.modal-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.modal-btn:hover {
  background: rgba(39, 39, 42, 0.8);
}

.modal-btn.danger {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.modal-btn.danger:hover {
  background: #dc2626;
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
