/* ============================================================
   Components — light theme, professional polish.
   ============================================================ */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast), color var(--t-fast);
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--color-surface-2); border-color: var(--color-border-hover); color: var(--color-text-primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn .material-icons { font-size: 1.15em; }

.btn--primary {
  background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), var(--shadow-xs);
}
.btn--primary:hover { background: var(--color-accent-dim); border-color: var(--color-accent-dim); color: #fff; }

.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--color-surface-3); border-color: transparent; }

.btn--soft { background: var(--color-accent-soft); border-color: var(--color-accent-border); color: var(--color-accent-dim); box-shadow: none; }
.btn--soft:hover { background: #e4e7fd; color: var(--color-accent-dim); }

.btn--danger { color: var(--color-error); border-color: var(--color-border); }
.btn--danger:hover { background: var(--color-error-soft); border-color: var(--color-error); color: var(--color-error); }

.btn--sm { padding: 7px 12px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn--lg { padding: 14px 24px; font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn--icon { padding: 9px; }

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.card--pad-lg { padding: var(--space-8); }
.card--interactive { transition: box-shadow var(--t), border-color var(--t), transform var(--t); }
.card--interactive:hover { box-shadow: var(--shadow-md); border-color: var(--color-border-hover); transform: translateY(-2px); }
.card__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-bottom: var(--space-1); }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--color-surface-3); color: var(--color-text-secondary);
  border: 1px solid transparent;
}
.badge .material-icons { font-size: 0.95em; }
.badge--active, .badge--valid { background: var(--color-success-soft); color: var(--color-success); }
.badge--draft { background: var(--color-surface-3); color: var(--color-text-secondary); }
.badge--ended { background: var(--color-surface-3); color: var(--color-text-muted); }
.badge--paused, .badge--pending { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--rejected { background: var(--color-error-soft); color: var(--color-error); }
.badge--accent { background: var(--color-accent-soft); color: var(--color-accent-dim); }

/* Numbered step marker (hub) */
.hub-step {
  display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 10px; background: var(--color-accent-soft); color: var(--color-accent-dim);
  font-family: var(--font-display); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums;
}

/* Prize callout (enter page) */
.enter-prize { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius); background: var(--color-accent-soft); margin-bottom: var(--space-6); }
.enter-prize .material-icons { color: var(--color-accent); font-size: 1.6rem; }
.enter-prize__label { display: block; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-accent-dim); font-weight: var(--fw-semibold); }
.enter-prize b { font-size: 1.05rem; }

/* Optional-field tag */
.field__opt { margin-left: 6px; font-weight: 400; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }

/* Input with a leading affix (e.g. @ for handles) */
.input-affix { display: flex; align-items: stretch; border: 1.5px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); overflow: hidden; transition: border-color var(--t), box-shadow var(--t); }
.input-affix:focus-within { border-color: var(--color-accent); box-shadow: var(--ring-accent); }
.input-affix__pre { display: flex; align-items: center; padding: 0 var(--space-3); background: var(--color-surface-2); border-right: 1px solid var(--color-border); color: var(--color-text-muted); font-weight: var(--fw-semibold); }
.input-affix .field-input { border: none; border-radius: 0; box-shadow: none; flex: 1; background: transparent; }
.input-affix .field-input:focus { box-shadow: none; border: none; }

/* Custom file upload */
.filedrop { position: relative; border: 1.5px dashed var(--color-border); border-radius: var(--radius); padding: var(--space-6) var(--space-4); text-align: center; cursor: pointer; transition: border-color var(--t), background var(--t); }
.filedrop:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.filedrop--has { border-style: solid; background: var(--color-surface); cursor: default; padding: var(--space-3) var(--space-4); }
.filedrop__native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filedrop--has .filedrop__native { display: none; }
.filedrop__empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--color-text-muted); pointer-events: none; }
.filedrop__empty .material-icons { font-size: 2rem; color: var(--color-accent); }
.filedrop__empty small { font-size: var(--fs-xs); }
.filedrop__has { display: flex; align-items: center; gap: var(--space-3); text-align: left; }
.filedrop__preview { width: 46px; height: 46px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; background: var(--color-surface-3); }
.filedrop__name { flex: 1; font-size: var(--fs-sm); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filedrop__remove { background: none; border: none; cursor: pointer; color: var(--color-text-muted); display: grid; place-items: center; padding: 6px; border-radius: var(--radius); }
.filedrop__remove:hover { background: var(--color-surface-3); }

/* --- Forms --- */
.field { display: block; margin-bottom: var(--space-4); }
.field__label { display: block; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--color-text-primary); margin-bottom: 6px; }
.field-input,
input[type="text"], input[type="email"], input[type="url"], input[type="number"],
input[type="date"], input[type="password"], input[type="search"], textarea, select {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: 11px 13px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input::placeholder, textarea::placeholder { color: var(--color-text-muted); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--ring-accent);
}
textarea { resize: vertical; min-height: 84px; }
input[type="file"] { padding: 9px; background: var(--color-surface-2); cursor: pointer; }
.checkbox { display: flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; font-size: var(--fs-sm); }
.checkbox input { width: auto; margin-top: 2px; accent-color: var(--color-accent); width: 16px; height: 16px; }
.field-error, .errorlist { color: var(--color-error); font-size: var(--fs-sm); margin-top: 5px; list-style: none; padding: 0; }
.helptext { color: var(--color-text-muted); font-size: var(--fs-sm); margin-top: 5px; }

/* --- Custom dropdown (Alpine; NO native select) --- */
.dropdown { position: relative; display: inline-block; }
.dropdown__trigger {
  display: inline-flex; align-items: center; gap: var(--space-2); justify-content: space-between;
  min-width: 170px; padding: 10px 13px;
  background: var(--color-surface); border: 1px solid var(--color-border-strong);
  border-radius: var(--radius); color: var(--color-text-primary);
  cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-medium);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.dropdown__trigger:hover { border-color: var(--color-border-hover); }
.dropdown__trigger[aria-expanded="true"] { border-color: var(--color-accent); box-shadow: var(--ring-accent); }
.dropdown__panel {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 100%;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; max-height: 280px; overflow-y: auto;
}
.dropdown__option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: var(--fs-sm); color: var(--color-text-primary);
}
.dropdown__option:hover, .dropdown__option.is-active { background: var(--color-surface-3); }
.dropdown__option[aria-selected="true"] { color: var(--color-accent); font-weight: var(--fw-semibold); }

/* Custom scrollbars */
.dropdown__panel::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.dropdown__panel::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 6px; border: 2px solid var(--color-surface); }

/* --- Tables --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th, table.data td { padding: 13px 16px; text-align: left; }
table.data thead th {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-text-muted); background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}
table.data tbody tr { border-bottom: 1px solid var(--color-border); }
table.data tbody tr:last-child { border-bottom: none; }
table.data tbody tr:hover { background: var(--color-surface-2); }
.num { font-variant-numeric: tabular-nums; }

/* --- Toasts --- */
.toast-stack {
  position: fixed; top: var(--space-6); right: var(--space-6); z-index: 100;
  display: flex; flex-direction: column; gap: var(--space-2); max-width: 380px;
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-text-muted);
  border-radius: var(--radius); padding: 13px 16px;
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  animation: toastIn var(--t-panel) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.toast--success { border-left-color: var(--color-success); }
.toast--error { border-left-color: var(--color-error); }
.toast--warning { border-left-color: var(--color-warning); }
.toast--info { border-left-color: var(--color-info); }
.toast--success .material-icons { color: var(--color-success); }
.toast--error .material-icons { color: var(--color-error); }
.toast--warning .material-icons { color: var(--color-warning); }
.toast--info .material-icons { color: var(--color-info); }
@media (max-width: 767px) {
  .toast-stack { left: var(--space-4); right: var(--space-4); top: var(--space-4); max-width: none; }
}
