/* ==========================================================================
   ScanFix Reusable Components
   Buttons, Badges, Cards, Terminal Frames, Tabs, Accordions, Forms, Modals
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.5rem;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.25;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan-500) 0%, var(--emerald-500) 100%);
  color: #040814;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px 0 rgba(6, 182, 212, 0.35);
  font-weight: 700;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--cyan-400) 0%, var(--emerald-400) 100%);
  color: #040814;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(6, 182, 212, 0.5), 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: rgba(18, 29, 54, 0.95);
  color: #ffffff;
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-medium);
}

.btn-outline:hover {
  color: var(--cyan-300);
  border-color: var(--cyan-500);
  background: var(--cyan-subtle);
}

.btn-lg {
  padding: 0.95rem 2rem;
  font-size: var(--text-lg);
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Badges, Indicators & Pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.25rem 0.65rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.2;
}

.badge-beacon {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--emerald-400);
  border-radius: 50%;
}

.badge-beacon::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--emerald-400);
  animation: pulseBeacon 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulseBeacon {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-300);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-300);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber-400);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-rose {
  background: rgba(244, 63, 94, 0.12);
  color: var(--rose-400);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.badge-purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple-400);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

/* --------------------------------------------------------------------------
   Cards & Surfaces
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.7), 0 0 20px var(--cyan-subtle);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.3), transparent);
}

.card-header {
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Terminal & Mockup Device Frames
   -------------------------------------------------------------------------- */
.device-frame {
  background: #090e1c;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 0 40px rgba(6, 182, 212, 0.15);
  overflow: hidden;
  position: relative;
}

.frame-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid var(--border-subtle);
}

.frame-dots {
  display: flex;
  gap: 6px;
}

.frame-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.frame-dot.red { background: #ef4444; }
.frame-dot.yellow { background: #f59e0b; }
.frame-dot.green { background: #10b981; }

.frame-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* --------------------------------------------------------------------------
   Score Gauge Circles
   -------------------------------------------------------------------------- */
.score-gauge {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-gauge svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-gauge circle {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.score-gauge .gauge-bg {
  stroke: rgba(255, 255, 255, 0.08);
}

.score-gauge .gauge-fill {
  stroke: var(--emerald-400);
  stroke-dasharray: 200;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 1s ease-out;
}

.score-value {
  position: absolute;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
.nav-tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--cyan-300);
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Accordion (FAQ)
   -------------------------------------------------------------------------- */
.accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.accordion-item {
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
  overflow: hidden;
}

.accordion-item:hover {
  border-color: var(--border-medium);
}

.accordion-item.active {
  border-color: var(--border-strong);
  background: rgba(18, 29, 54, 0.6);
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  gap: var(--space-4);
}

.accordion-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--cyan-400);
  transition: transform var(--transition-normal);
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal) ease-out;
}

.accordion-item.active .accordion-body {
  max-height: 400px;
}

.accordion-content {
  padding: 0 1.5rem 1.25rem 1.5rem;
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Forms & Inputs
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--cyan-400);
  margin-left: 2px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.85rem 1.15rem;
  background: rgba(6, 12, 24, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--cyan-400);
  box-shadow: 0 0 0 3px var(--cyan-glow);
  background: rgba(8, 15, 30, 0.95);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-subtle);
}

.form-select {
  cursor: pointer;
}

.form-select option {
  background: #0b1426;
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-input.is-invalid, .form-select.is-invalid {
  border-color: var(--rose-500);
}

.invalid-feedback {
  display: none;
  font-size: var(--text-xs);
  color: var(--rose-400);
  margin-top: var(--space-1);
}

.form-input.is-invalid + .invalid-feedback {
  display: block;
}

/* Multi-select exploration pills */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.pill-option {
  cursor: pointer;
  user-select: none;
}

.pill-option input[type="checkbox"] {
  display: none;
}

.pill-label {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.pill-option:hover .pill-label {
  border-color: var(--border-highlight);
  color: var(--text-primary);
}

.pill-option input[type="checkbox"]:checked + .pill-label {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--cyan-400);
  color: var(--cyan-300);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 1rem 1.25rem;
  background: #0f1a30;
  border: 1px solid var(--cyan-500);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-xl), 0 0 20px var(--cyan-glow);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 17, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: #0b1427;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 0 60px rgba(6, 182, 212, 0.2);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--text-2xl);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.75rem;
}
