/* Exclivia · components.css — piezas reutilizables.
 * Prefijo exc- en todo para no chocar con Bootstrap (ni con Tailwind el día que
 * el admin cambie de framework: los componentes viven de las variables, no del
 * framework).
 */

/* ── Tarjetas ───────────────────────────────────────────────────────────── */

.exc-card {
  background: var(--exc-surface);
  border: var(--exc-border-width) solid var(--exc-border);
  border-radius: var(--exc-radius-card);
  padding: 1.25rem;
  box-shadow: var(--exc-shadow);
}

.exc-card + .exc-card { margin-top: 1rem; }

.exc-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.exc-card-title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.exc-card-sub   { margin: .15rem 0 0; font-size: .85rem; color: var(--exc-muted); }

.exc-card-accent { border-left: 3px solid var(--exc-accent); }

.exc-card-link {
  display: block; color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.exc-card-link:hover {
  transform: translateY(-2px);
  border-color: var(--exc-accent);
  box-shadow: var(--exc-shadow-lg);
  opacity: 1;
}

/* ── Botones ────────────────────────────────────────────────────────────── */

.exc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.15rem;
  min-height: 44px;               /* objetivo táctil cómodo en celular */
  border: var(--exc-border-width) solid transparent;
  border-radius: var(--exc-radius);
  font: inherit; font-size: .94rem; font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .1s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.exc-btn:active { transform: translateY(1px); }
.exc-btn:disabled, .exc-btn.is-busy { opacity: .6; cursor: not-allowed; }

.exc-btn-primary {
  background: var(--exc-accent);
  color: var(--exc-accent-contrast);
  border-color: var(--exc-accent);
}
.exc-btn-primary:hover { filter: brightness(1.06); opacity: 1; }

.exc-btn-outline {
  background: transparent;
  color: var(--exc-text);
  border-color: var(--exc-border);
}
.exc-btn-outline:hover { border-color: var(--exc-accent); color: var(--exc-accent); opacity: 1; }

.exc-btn-ghost {
  background: transparent; color: var(--exc-text); border-color: transparent;
}
.exc-btn-ghost:hover { background: var(--exc-surface-2); opacity: 1; }

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

.exc-btn-sm    { padding: .4rem .8rem; min-height: 36px; font-size: .85rem; }
.exc-btn-lg    { padding: .85rem 1.6rem; min-height: 52px; font-size: 1rem; }
.exc-btn-block { display: flex; width: 100%; }
.exc-btn-icon  { padding: .5rem; min-width: 44px; }

/* Estado cargando: el texto se atenúa y aparece el giro. */
.exc-btn .exc-spinner { display: none; }
.exc-btn.is-busy .exc-spinner { display: inline-block; }

.exc-spinner {
  width: 1em; height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: exc-spin .7s linear infinite;
}
@keyframes exc-spin { to { transform: rotate(360deg); } }

/* ── Formularios ────────────────────────────────────────────────────────── */

.exc-field { margin-bottom: 1rem; }

.exc-label {
  display: block;
  margin-bottom: .35rem;
  font-size: .88rem;
  font-weight: 600;
}

.exc-input, .exc-select, .exc-textarea {
  display: block; width: 100%;
  padding: .68rem .85rem;
  min-height: 46px;
  font: inherit;
  font-size: 16px;               /* menos de 16px hace que iOS acerque el zoom */
  color: var(--exc-text);
  background: var(--exc-bg);
  border: var(--exc-border-width) solid var(--exc-border);
  border-radius: var(--exc-radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.exc-input:focus, .exc-select:focus, .exc-textarea:focus {
  outline: none;
  border-color: var(--exc-accent);
  box-shadow: 0 0 0 3px rgba(var(--exc-accent-rgb), .18);
}
.exc-input::placeholder, .exc-textarea::placeholder { color: var(--exc-muted); }
.exc-input:disabled, .exc-select:disabled, .exc-textarea:disabled {
  opacity: .6; cursor: not-allowed;
}
.exc-textarea { min-height: 110px; resize: vertical; }

.exc-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.4rem;
}

.exc-hint  { margin: .3rem 0 0; font-size: .8rem; color: var(--exc-muted); }
.exc-error { margin: .3rem 0 0; font-size: .8rem; color: var(--exc-danger); }
.exc-input.is-invalid, .exc-select.is-invalid { border-color: var(--exc-danger); }
.exc-input.is-valid { border-color: var(--exc-success); }

/* Casilla y switch */
.exc-check {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .5rem 0; cursor: pointer;
}
.exc-check input { width: 20px; height: 20px; accent-color: var(--exc-accent); flex: none; margin-top: .1rem; }

.exc-switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; }
.exc-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.exc-switch-track {
  width: 46px; height: 26px; flex: none;
  background: var(--exc-border);
  border-radius: 999px;
  position: relative;
  transition: background .18s ease;
}
.exc-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--exc-surface);
  transition: transform .18s ease;
}
.exc-switch input:checked + .exc-switch-track { background: var(--exc-accent); }
.exc-switch input:checked + .exc-switch-track::after { transform: translateX(20px); }
.exc-switch input:focus-visible + .exc-switch-track { outline: 2px solid var(--exc-accent); outline-offset: 2px; }

/* Opciones tocables — en celular se usan mejor que un <select>. */
.exc-choices { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.exc-choice {
  position: relative;
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem .9rem;
  border: var(--exc-border-width) solid var(--exc-border);
  border-radius: var(--exc-radius);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.exc-choice input { position: absolute; opacity: 0; }
.exc-choice.is-selected { border-color: var(--exc-accent); background: rgba(var(--exc-accent-rgb), .08); }

/* Color: el navegador pinta un cuadrito feo; se le da forma. */
.exc-color {
  width: 46px; height: 46px; padding: 3px;
  border: var(--exc-border-width) solid var(--exc-border);
  border-radius: var(--exc-radius-sm);
  background: var(--exc-bg);
  cursor: pointer;
}
.exc-color-row { display: flex; align-items: center; gap: .7rem; }
.exc-color-row .exc-input { max-width: 130px; font-family: ui-monospace, monospace; }

/* ── Avisos ─────────────────────────────────────────────────────────────── */

.exc-alert {
  padding: .85rem 1rem;
  border-radius: var(--exc-radius);
  border: 1px solid transparent;
  font-size: .92rem;
  margin-bottom: 1rem;
}
.exc-alert-success { background: rgba(30,158,106,.12); border-color: rgba(30,158,106,.35); color: var(--exc-success); }
.exc-alert-danger  { background: rgba(214,72,63,.12);  border-color: rgba(214,72,63,.35);  color: var(--exc-danger); }
.exc-alert-warning { background: rgba(217,133,24,.12); border-color: rgba(217,133,24,.35); color: var(--exc-warning); }
.exc-alert-info    { background: rgba(47,125,209,.12); border-color: rgba(47,125,209,.35); color: var(--exc-info); }

/* ── Badges ─────────────────────────────────────────────────────────────── */

.exc-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.exc-badge-accent  { background: rgba(var(--exc-accent-rgb), .16); color: var(--exc-accent); }
.exc-badge-success { background: rgba(30,158,106,.16); color: var(--exc-success); }
.exc-badge-warning { background: rgba(217,133,24,.16); color: var(--exc-warning); }
.exc-badge-danger  { background: rgba(214,72,63,.16);  color: var(--exc-danger); }
.exc-badge-muted   { background: var(--exc-surface-2); color: var(--exc-muted); }

.exc-badge.is-solid   { color: var(--exc-accent-contrast); background: var(--exc-accent); }
.exc-badge.is-outline { background: transparent; border-color: currentColor; }

/* ── Avatares ───────────────────────────────────────────────────────────── */

.exc-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--exc-surface-2);
}
.exc-avatar-initials {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  color: var(--exc-accent-contrast);
  background: var(--exc-accent);
}
.exc-avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.exc-avatar-lg { width: 64px; height: 64px; font-size: 1.1rem; }
.exc-avatar-xl { width: 112px; height: 112px; font-size: 1.9rem; }

/* ── Tablas ─────────────────────────────────────────────────────────────── */

/* La tabla se desplaza DENTRO de su caja: la página nunca se mueve de lado. */
.exc-table-wrap {
  overflow-x: auto;
  border: var(--exc-border-width) solid var(--exc-border);
  border-radius: var(--exc-radius-card);
  background: var(--exc-surface);
  -webkit-overflow-scrolling: touch;
}
.exc-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.exc-table th, .exc-table td {
  padding: .75rem .9rem;
  text-align: left;
  border-bottom: 1px solid var(--exc-border);
  vertical-align: middle;
}
.exc-table th {
  font-size: .76rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--exc-muted);
  background: var(--exc-surface-2);
  white-space: nowrap;
}
.exc-table tbody tr:last-child td { border-bottom: 0; }
.exc-table tbody tr:hover { background: var(--exc-surface-2); }
.exc-table-actions { display: flex; gap: .4rem; justify-content: flex-end; }

/* ── Estado vacío ───────────────────────────────────────────────────────── */

.exc-empty { padding: 2.5rem 1rem; text-align: center; color: var(--exc-muted); }
.exc-empty-icon  { font-size: 2.4rem; opacity: .55; margin-bottom: .5rem; }
.exc-empty-title { margin: 0 0 .25rem; font-weight: 600; color: var(--exc-text); }
.exc-empty-hint  { margin: 0; font-size: .88rem; }

/* ── Pestañas ───────────────────────────────────────────────────────────── */

.exc-tabs {
  display: flex; gap: .25rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--exc-border);
  margin-bottom: 1.25rem;
  scrollbar-width: none;
}
.exc-tabs::-webkit-scrollbar { display: none; }
.exc-tab {
  padding: .7rem 1rem;
  border: 0; background: transparent;
  color: var(--exc-muted);
  font: inherit; font-size: .9rem; font-weight: 600;
  white-space: nowrap; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.exc-tab:hover { color: var(--exc-text); }
.exc-tab.is-active { color: var(--exc-accent); border-bottom-color: var(--exc-accent); }
.exc-tabpanel[hidden] { display: none; }

/* ── Avisos flotantes ───────────────────────────────────────────────────── */

.exc-toasts {
  position: fixed; z-index: 1080;
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem);
  display: flex; flex-direction: column; gap: .5rem;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}
@media (min-width: 992px) {
  .exc-toasts { left: auto; right: 1.5rem; transform: none; bottom: 1.5rem; }
}
.exc-toast {
  pointer-events: auto;
  padding: .8rem 1rem;
  border-radius: var(--exc-radius);
  background: var(--exc-surface);
  border: 1px solid var(--exc-border);
  box-shadow: var(--exc-shadow-lg);
  font-size: .9rem;
  animation: exc-toast-in .22s ease;
}
.exc-toast-success { border-left: 3px solid var(--exc-success); }
.exc-toast-danger  { border-left: 3px solid var(--exc-danger); }
.exc-toast-warning { border-left: 3px solid var(--exc-warning); }
.exc-toast-info    { border-left: 3px solid var(--exc-info); }
@keyframes exc-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Barra de progreso ──────────────────────────────────────────────────── */

.exc-progress {
  height: 8px; border-radius: 999px;
  background: var(--exc-surface-2);
  overflow: hidden;
}
.exc-progress-bar {
  height: 100%;
  background: var(--exc-accent);
  transition: width .3s ease;
}

/* ── Esqueleto de carga ─────────────────────────────────────────────────── */

.exc-skeleton {
  background: linear-gradient(90deg, var(--exc-surface-2) 25%, var(--exc-border) 50%, var(--exc-surface-2) 75%);
  background-size: 200% 100%;
  animation: exc-shimmer 1.3s infinite;
  border-radius: var(--exc-radius-sm);
}
@keyframes exc-shimmer { to { background-position: -200% 0; } }

/* ── Encabezado de página ───────────────────────────────────────────────── */

.exc-page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.exc-page-title { margin: 0; }
.exc-page-sub   { margin: .25rem 0 0; color: var(--exc-muted); font-size: .92rem; }

/* Anchos fijos para demos y barras estáticas — evitan un style="" suelto en
   las vistas. Los porcentajes calculados en tiempo real sí van como atributo,
   porque son un DATO, no una decisión de diseño. */
.exc-w-25 { width: 25%; }
.exc-w-50 { width: 50%; }
.exc-w-70 { width: 70%; }
.exc-w-100 { width: 100%; }

/* ── Pares clave / valor ────────────────────────────────────────────────────
   Vivían sólo en el CSS del admin, pero `.exc-kv` también se usa en el panel
   del usuario («Tu cuenta»), que no carga ese archivo: ahí la etiqueta y el
   valor salían pegados —«Usuario@iigoons»— porque la clase no tenía estilo.
   Al ser un componente compartido, su sitio es este. */
.exc-kv {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: .3rem 0;
  font-size: .88rem;
}
.exc-kv span { color: var(--exc-muted); }
