/* =====================================================
   HOMIUM Audit Platform — Components
   ===================================================== */

/* ----- BUTTONS ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 40px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.btn:active  { transform: scale(0.97); }
.btn:disabled,
.btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Tamaños */
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 28px; font-size: 15px; }

/* Icon buttons — círculo uniforme en todos los tamaños */
.btn-icon    { width: 40px; height: 40px; padding: 0; }
.btn-icon-sm { width: 32px; height: 32px; padding: 0; font-size: 13px; }
.btn-icon-lg { width: 48px; height: 48px; padding: 0; font-size: 15px; }

/* Variante: Primary — fill cyan, texto purple */
.btn-primary { background: var(--homium-cyan); color: var(--homium-purple); border-color: var(--homium-cyan); }
.btn-primary:hover { background: var(--cyan-300); border-color: var(--cyan-300); box-shadow: var(--glow-cyan); color: var(--homium-purple); }

/* Variante: Ghost — borde sutil → cyan on hover */
.btn-ghost { background: transparent; color: var(--fg-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-overlay); border-color: var(--homium-cyan); color: var(--homium-cyan); }

/* Variante: Danger — borde rojo, fill on hover */
.btn-danger { background: transparent; color: #ff5f5f; border-color: rgba(255,95,95,0.35); font-weight: 600; }
.btn-danger:hover { background: rgba(255,95,95,0.10); border-color: rgba(255,95,95,0.65); }

/* ----- FORM INPUTS ----- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field label {
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
}

.input {
  width: 100%;
  padding: 12px var(--sp-4);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg);
  font-size: var(--fs-body);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  outline: none;
}

.input::placeholder { color: var(--fg-subtle); }

.input:focus {
  border-color: var(--homium-cyan);
  box-shadow: 0 0 0 3px rgba(0,255,255,0.12);
}

/* ----- CARDS ----- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

/* ----- SCORE BADGE ----- */

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.score-badge.high  { background: rgba(90,234,162,0.15); color: var(--score-high); }
.score-badge.mid   { background: rgba(245,200,66,0.15);  color: var(--score-mid); }
.score-badge.low   { background: rgba(255,95,95,0.15);   color: var(--score-low); }

/* ----- SCORE RING (detalle) ----- */

.score-ring {
  --size: 72px;
  --stroke: 5px;
  position: relative;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
}

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

.score-ring .track  { fill: none; stroke: var(--border); stroke-width: var(--stroke); }
.score-ring .fill   { fill: none; stroke-width: var(--stroke); stroke-linecap: round; transition: stroke-dashoffset var(--dur-slow) var(--ease-out); }
.score-ring .fill.high  { stroke: var(--score-high); }
.score-ring .fill.mid   { stroke: var(--score-mid); }
.score-ring .fill.low   { stroke: var(--score-low); }

.score-ring .ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

/* ----- TABLE ----- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-subtle);
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease-out);
  cursor: pointer;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--surface-overlay); }

tbody td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  vertical-align: middle;
}

tbody td.domain {
  font-weight: 500;
  color: var(--fg);
  font-size: var(--fs-body);
}

/* ----- SECTOR TAG ----- */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: 0.03em;
  background: rgba(90,234,162,0.10);
  color: var(--accent-2);
  border: 1px solid rgba(90,234,162,0.20);
}

/* ----- DIVIDER ----- */

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-5) 0;
}

/* ----- EMPTY STATE ----- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-9) var(--sp-5);
  text-align: center;
  color: var(--fg-subtle);
}

.empty-state .empty-icon {
  font-size: 40px;
  opacity: 0.4;
}

/* ----- TOAST / ALERT ----- */

.alert {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-body-sm);
}

.alert-error {
  background: rgba(255,95,95,0.12);
  border: 1px solid rgba(255,95,95,0.30);
  color: #ff8080;
}

.alert-success {
  background: rgba(90,234,162,0.12);
  border: 1px solid rgba(90,234,162,0.30);
  color: var(--accent-2);
}

/* ----- SPINNER ----- */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
