/* ===================================================================
   HELIX Design System — Shared Components
   Cards, buttons, pills, timer, toast, loading, error, skip-link
   =================================================================== */

/* -- Cards --------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card--glass {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.card__body {
  padding: 20px;
}

/* -- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

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

.btn--primary {
  background: var(--teal);
  color: #0c0f14;
}

.btn--primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--glass-border);
}

.btn--danger {
  background: var(--rose);
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn--sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn--lg {
  padding: 12px 24px;
  font-size: 1rem;
}

/* -- Phase Pills --------------------------------------------------- */
.phase-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.phase-pill {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  font-size: 0.85rem;
}

.phase-pill:hover {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text);
}

.phase-pill--active,
.phase-pill.active {
  background: rgba(45, 212, 191, 0.2);
  border-color: var(--teal);
  color: var(--teal);
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.2);
}

.phase-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.phase-arrow {
  color: var(--text-muted);
  margin: 0 2px;
  font-size: 0.8rem;
}

/* -- Timer SVG ----------------------------------------------------- */
.timer-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.timer-svg {
  width: 40px;
  height: 40px;
  transform: rotate(-90deg);
  cursor: pointer;
}

.timer-track {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 3;
}

.timer-progress {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s linear, stroke 0.3s;
}

.timer-text {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--green);
  min-width: 48px;
}

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

.toast {
  padding: 12px 16px;
  background: rgba(21, 25, 33, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  font-size: 0.9rem;
  max-width: 360px;
}

.toast--success {
  border-left: 3px solid var(--green);
}

.toast--error {
  border-left: 3px solid var(--rose);
}

.toast--info {
  border-left: 3px solid var(--blue);
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  flex-shrink: 0;
}

.toast-text {
  flex: 1;
}

/* -- Loading State ------------------------------------------------- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-dim);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.85rem;
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* -- Error State --------------------------------------------------- */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}

.error-icon {
  font-size: 2rem;
}

.error-message {
  color: var(--text-dim);
  font-size: 0.9rem;
  max-width: 400px;
}

/* -- Skip Link (Accessibility) ------------------------------------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--teal);
  color: #0c0f14;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  top: 0;
  left: 0;
}

/* -- Modal Overlay ------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 540px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

/* -- HELIX Header -------------------------------------------------- */
.helix-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* -- Form Inputs --------------------------------------------------- */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.input:focus {
  border-color: var(--teal);
  outline: none;
}

.input::placeholder {
  color: var(--text-muted);
}
