/* ==========================================================================
   components.css  -  Piezas compartidas por landing y workspace
   ========================================================================== */

/* iconos (sprite inline en index.html) */
.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
:root[data-theme="dark"] .t-moon { display: none; }
:root:not([data-theme="dark"]) .t-sun { display: none; }

/* botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-md);
  font-size: .9375rem; font-weight: 550; line-height: 1; white-space: nowrap;
  transition: background-color var(--t), border-color var(--t), color var(--t);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet { color: var(--muted); }
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 1rem; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .875rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-md); color: var(--muted);
  transition: background-color var(--t), color var(--t);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* campos */
.field { display: grid; gap: 6px; align-content: start; } /* sin esto, en una fila con campos de distinta altura el input se estira */
.label { font-size: .875rem; font-weight: 550; }
.hint { font-size: .8125rem; color: var(--subtle); }
.field-error { font-size: .8125rem; color: var(--danger); }
.input, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color var(--t);
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.input:hover, .textarea:hover { border-color: var(--subtle); }
.input:focus-visible, .textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--subtle); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }

/* interruptor */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; flex: none; width: 36px; height: 20px; margin-top: 2px;
  border-radius: 0; background: var(--border-strong);
  transition: background-color var(--t);
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 0; background: #fff;
  transition: transform var(--t) var(--ease);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-text { display: grid; gap: 2px; }
.switch-title { font-size: .9375rem; font-weight: 550; }

/* etiquetas */
.tag, .status {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 0; font-size: .8125rem; font-weight: 550;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.tag-groups { background: var(--groups-soft); color: var(--groups); }
.tag-sales, .tag-business { background: var(--sales-soft); color: var(--sales); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 0; background: var(--subtle); }

/* icono de modo (cuadro con icono) */
.mode-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: var(--r-md); background: var(--surface-2); color: var(--muted);
}
.mode-groups .mode-icon, .mode-icon.is-groups { background: var(--groups-soft); color: var(--groups); }
.mode-sales .mode-icon, .mode-business .mode-icon, .mode-icon.is-sales { background: var(--sales-soft); color: var(--sales); }

/* vacio */
.empty {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 40px 24px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
}
.empty p { max-width: 44ch; color: var(--muted); }

/* avisos */
.toasts {
  position: fixed; inset: auto 0 20px 0; z-index: 200;
  display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px;
}
.toast {
  pointer-events: auto; padding: 10px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg); font-size: .9375rem;
  box-shadow: var(--shadow-pop); animation: toast-in .16s var(--ease);
}
.toast-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
