/* ================================================================
   components.css — Reusable UI components
   ================================================================ */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-lg);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s, opacity 0.15s; }
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background-color: var(--accent-success);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background-color: #4ea84e; }

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background-color: var(--bg-primary); }

.btn-tertiary {
  background: none; border: none;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
  min-height: 40px;
}
.btn-tertiary:hover:not(:disabled) { color: var(--text-primary); background-color: rgba(0,0,0,0.04); }

.btn-lg {
  min-height: 52px;
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-lg);
}
.btn-full { width: 100%; }

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  display: inline-flex; align-items: center; gap: var(--space-xs);
}
.btn-icon:hover { background: var(--bg-primary); }

.btn-link {
  background: none; border: none;
  color: var(--accent-primary);
  cursor: pointer; text-decoration: underline;
  font-weight: 700; padding: 0;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; pointer-events: auto;
}
@media (prefers-reduced-motion: no-preference) {
  .modal-overlay { animation: modalFadeIn 0.25s ease-out; }
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--surface);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  max-width: 420px; width: 90vw;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  position: relative; z-index: 1001;
}
.modal-title { font-size: var(--font-size-2xl); font-weight: 800; margin-bottom: var(--space-sm); }
.modal-subtitle { color: var(--text-secondary); margin-bottom: var(--space-lg); }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: var(--space-lg) 0; }
.modal-alt-text { text-align: center; color: var(--text-secondary); font-size: var(--font-size-sm); }

/* ---- Forms ---- */
.form-stack { display: flex; flex-direction: column; gap: var(--space-lg); }
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.form-label {
  font-weight: 700; font-size: var(--font-size-sm);
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-input {
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--text-primary); background: var(--surface);
  width: 100%;
}
.form-input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}
.form-input-mono {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 3px;
  font-size: var(--font-size-xl);
  text-align: center;
}

/* Gender toggle */
.toggle-group { display: flex; gap: var(--space-sm); }
.toggle-btn {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  min-height: var(--touch-min);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer; font-weight: 700;
  color: var(--text-secondary);
  touch-action: manipulation;
}
@media (prefers-reduced-motion: no-preference) {
  .toggle-btn { transition: all 0.15s; }
}
.toggle-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
input[type="radio"]:checked + .toggle-btn {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
}

/* ---- Skip perception modal ---- */
.skip-modal-overlay {
  display: none; position: fixed; inset: 0;
  z-index: 2100; pointer-events: auto;
  background: transparent;
  align-items: flex-end; justify-content: center;
  padding: var(--space-md) var(--space-md) max(var(--space-md), env(safe-area-inset-bottom));
}
.skip-modal-panel {
  max-width: 560px; width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-lg);
  box-shadow: 0 -12px 40px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
}
.skip-modal-title { font-size: var(--font-size-xl); font-weight: 800; margin-bottom: var(--space-lg); }
.skip-choices { display: flex; flex-direction: column; gap: var(--space-sm); }
.skip-choice {
  width: 100%; text-align: left;
  padding: var(--space-md) var(--space-lg);
  min-height: 56px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1rem; font-weight: 600;
  cursor: pointer; touch-action: manipulation;
}
@media (prefers-reduced-motion: no-preference) {
  .skip-choice { transition: background-color 0.15s, border-color 0.15s, transform 0.1s; }
}
.skip-choice:hover { background-color: var(--bg-primary); }
.skip-choice:active { transform: scale(0.98); }
.skip-choice--neutral  { border-left: 5px solid var(--border-strong); }
.skip-choice--accept   { border-left: 5px solid var(--accent-success); }
.skip-choice--reject   { border-left: 5px solid var(--accent-danger); }

/* ---- Progress indicator ---- */
.progress-indicator { display: flex; flex-direction: column; gap: var(--space-xs); flex: 1; min-width: 0; }
.progress-text { font-size: var(--font-size-sm); font-weight: 700; color: var(--text-secondary); }
.progress-segments { display: flex; gap: 3px; }
.progress-segment {
  height: 4px; flex: 1; border-radius: 2px;
  background: var(--border);
}
@media (prefers-reduced-motion: no-preference) {
  .progress-segment { transition: background-color 0.3s; }
}
.progress-segment.is-done    { background: var(--accent-success); }
.progress-segment.is-current { background: var(--accent-primary); }

/* ---- Match quality bar ---- */
.match-bar-wrap { margin: var(--space-md) 0; display: flex; align-items: center; gap: var(--space-md); }
.match-bar {
  flex: 1; height: 8px;
  background: var(--border); border-radius: 4px; overflow: hidden;
}
.match-bar-fill {
  height: 100%; width: 0%;
  border-radius: 4px;
  background: var(--accent-danger);
}
@media (prefers-reduced-motion: no-preference) {
  .match-bar-fill { transition: width 0.3s, background-color 0.3s; }
}
.match-bar-label {
  font-size: var(--font-size-sm); font-weight: 700;
  color: var(--text-secondary); min-width: 70px; text-align: right;
}

/* ---- Drop badge ---- */
.drop-badge {
  display: flex; align-items: center; justify-content: center;
  min-width: 28px; height: 24px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--font-size-sm); font-weight: 800;
  color: var(--text-primary); box-shadow: var(--shadow-sm);
}
@media (prefers-reduced-motion: no-preference) {
  .drop-badge { transition: transform 0.15s ease-out; }
  .drop-badge.is-bumped { transform: scale(1.25); }
}

/* ---- User badge ---- */
.user-badge {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: var(--surface); border: 1px solid var(--border);
  font-size: var(--font-size-sm);
}
.user-badge-label { color: var(--text-secondary); font-weight: 600; }
.user-badge-id {
  color: var(--accent-primary); font-weight: 800;
  font-family: 'Courier New', Courier, monospace;
}

/* ---- Overflow menu ---- */
.overflow-menu { position: relative; }
.overflow-trigger {
  font-size: 1.5rem; letter-spacing: 2px;
  min-width: var(--touch-min); justify-content: center;
}
.overflow-dropdown {
  display: none; position: absolute;
  bottom: calc(100% + var(--space-sm)); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  min-width: 180px; z-index: 500; overflow: hidden;
}
.overflow-dropdown.is-open { display: block; }
.overflow-item {
  display: block; width: 100%; text-align: left;
  padding: var(--space-md) var(--space-lg);
  border: none; background: none; cursor: pointer;
  font-size: 1rem; color: var(--text-primary);
}
@media (prefers-reduced-motion: no-preference) {
  .overflow-item { transition: background-color 0.1s; }
}
.overflow-item:hover { background-color: var(--bg-primary); }
.overflow-item:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- Color circle tap feedback ---- */
@media (prefers-reduced-motion: no-preference) {
  .color-circle { transition: transform 0.1s ease-out, box-shadow 0.15s; }
  .color-circle.is-tapped { transform: scale(0.93); }
}

/* ---- Generated ID ---- */
.generated-id {
  font-size: 2.5rem; font-weight: 900;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 4px; text-align: center;
  color: var(--accent-primary); padding: var(--space-md) 0;
}

/* ---- Timer ---- */
.timer-display {
  text-align: center; font-size: var(--font-size-sm);
  color: var(--text-secondary); padding: var(--space-sm) 0;
}

/* ---- Footer ---- */
.app-footer {
  text-align: center; padding: var(--space-lg);
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
  color: var(--text-secondary); font-size: var(--font-size-sm);
}
.app-footer .footer-copy { margin-top: var(--space-xs); font-size: 0.8rem; opacity: 0.7; }

/* ---- Mobile overrides ---- */
@media (max-width: 600px) {
  .modal-card {
    padding: var(--space-lg);
    max-height: 90dvh;
    overflow-y: auto;
  }
  .modal-title { font-size: var(--font-size-xl); }
  .btn-lg { min-height: 48px; font-size: 1rem; }
  .skip-modal-panel { padding: var(--space-md); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .skip-modal-title { font-size: var(--font-size-lg); margin-bottom: var(--space-md); }
  .skip-choice { min-height: 52px; padding: var(--space-sm) var(--space-md); }
}

/* ---- Video modal ---- */
.video-modal-inner {
  position: relative; width: 90%; max-width: 800px;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: var(--space-lg); box-shadow: var(--shadow-lg);
}
.video-close {
  position: absolute; top: var(--space-sm); right: var(--space-md);
  background: none; border: none;
  color: var(--text-secondary); font-size: 28px;
  cursor: pointer; z-index: 1; min-width: var(--touch-min); min-height: var(--touch-min);
  display: flex; align-items: center; justify-content: center;
}
.video-close:hover { color: var(--text-primary); }
.video-aspect {
  position: relative; width: 100%; height: 0;
  padding-bottom: 56.25%;
}
.video-aspect iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: none; border-radius: var(--radius-md);
}
