/* Componentes compartidos: marca, botones, pills, tarjetas, ventanas, bisel de hardware, formularios, lightbox */

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-12);
  color: var(--text-primary);
  font-size: var(--t-h3);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.brand b {
  font-weight: 600;
  color: var(--brand-primary);
}

/* Pill de cobre: versión, kickers y etiquetas de función */
.pill-brand,
.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: var(--s-4) var(--s-12);
  border: 1px solid var(--brand-tint-border);
  border-radius: var(--radius-pill);
  background: var(--brand-tint-bg);
  color: var(--brand-tint-text);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.eyebrow {
  margin-bottom: var(--s-16);
}

/* Botones: secundario por defecto, primario naranja (máx. 1 por sección) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  min-height: 48px;
  padding: var(--s-12) var(--s-20);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: var(--t-ui);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color var(--fast) ease-out, background-color var(--fast) ease-out, transform var(--fast) ease-out,
    box-shadow var(--fast) ease-out;
}

.btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-3);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-sm {
  min-height: 40px;
  padding: var(--s-8) var(--s-16);
}

.btn-primary {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--brand-gradient);
  color: var(--text-on-brand);
  box-shadow: 0 4px 20px -4px rgba(255, 107, 0, 0.45);
}

.btn-primary:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: var(--brand-gradient);
  box-shadow: 0 6px 24px -4px rgba(255, 107, 0, 0.55);
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.6;
}

/* Enlace de texto con chevron */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  min-height: 48px;
  color: var(--text-primary);
  font-size: var(--t-ui);
  font-weight: 500;
  transition: color var(--fast) ease-out;
}

.text-link:hover {
  color: var(--brand-primary-hover);
}

.text-link svg {
  width: 16px;
  height: 16px;
  transition: transform var(--fast) ease-out;
}

.text-link:hover svg {
  transform: translateX(var(--s-4));
}

/* Enlaces dentro de párrafos */
.link {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-hover);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--fast) ease-out, color var(--fast) ease-out;
}

.link:hover {
  color: var(--brand-primary-hover);
  text-decoration-color: var(--brand-primary-hover);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border-hover);
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--text-primary);
}

/* Estados operativos */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-4) var(--s-12);
  border-radius: var(--radius-pill);
  background: var(--bg-surface-3);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 600;
  line-height: 1.5;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-live {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.badge-dev {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.badge-plain::before {
  display: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
}

.tag {
  padding: var(--s-4) var(--s-12);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-1);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  line-height: 1.5;
}

/* Tarjeta: degradado de superficie, borde fino y brillo superior */
.card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-surface-2) 0%, var(--bg-surface-1) 100%);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.3s ease-out;
}

.card:hover {
  border-color: rgba(255, 107, 0, 0.35);
}

.icon-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface-3);
  color: var(--text-primary);
  transition: border-color 0.3s ease-out, background-color 0.3s ease-out, color 0.3s ease-out;
}

.card:hover .icon-badge {
  border-color: var(--brand-tint-border);
  background: var(--brand-tint-bg);
  color: var(--brand-tint-text);
}

/* Ventana de código / terminal */
.window {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-surface-2) 0%, var(--bg-surface-1) 100%);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-12) var(--s-16);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  line-height: 1.5;
}

.window-bar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-surface-3);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.window-bar span {
  margin-left: var(--s-8);
}

.code {
  padding: var(--s-24);
  font-family: var(--font-mono);
  font-size: var(--t-ui);
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: auto;
}

.code .k {
  color: var(--text-secondary);
}

.code .s {
  color: var(--text-primary);
}

.code .ok {
  color: var(--status-success);
}

.code .warn {
  color: var(--status-warning);
}

/* Bisel de hardware para capturas de TPV, kiosco y panel */
.bezel {
  padding: var(--s-8);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-bezel);
  background: var(--bg-bezel);
}

.bezel img {
  border-radius: var(--radius-md);
}

/* Formularios */
.field {
  display: grid;
  gap: var(--s-8);
}

.field label,
.field-label {
  color: var(--text-primary);
  font-size: var(--t-ui);
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--s-12) var(--s-16);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-size: var(--t-body);
  line-height: 1.5;
  transition: border-color var(--fast) ease-out, box-shadow var(--fast) ease-out;
}

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

.field input:hover,
.field textarea:hover {
  border-color: var(--border-hover);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
  outline: none;
}

.field textarea {
  min-height: 128px;
  resize: vertical;
}

.field.has-error input,
.field.has-error textarea {
  border-color: var(--status-danger);
}

.field-error {
  color: #f87171;
  font-size: var(--t-ui);
}

.field-error:empty {
  display: none;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-12);
  color: var(--text-secondary);
  font-size: var(--t-ui);
  cursor: pointer;
}

.check input {
  flex: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 2px 0 0;
  accent-color: var(--brand-primary);
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-status {
  font-size: var(--t-ui);
}

.form-status:empty {
  display: none;
}

.form-status.ok {
  color: var(--status-success);
}

.form-status.err {
  color: #f87171;
}

/* Banner de cookies */
.cookie-banner {
  position: fixed;
  right: var(--s-16);
  bottom: var(--s-16);
  left: var(--s-16);
  z-index: 150;
  display: grid;
  gap: var(--s-16);
  max-width: 560px;
  padding: var(--s-24);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  font-size: var(--t-ui);
  line-height: 1.5;
}

.cookie-actions {
  display: flex;
  gap: var(--s-8);
}

@media (min-width: 640px) {
  .cookie-banner {
    left: auto;
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-64) var(--s-16);
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(12px);
}

.lightbox.is-open {
  display: flex;
}

.lightbox figure {
  max-width: min(1280px, 100%);
}

.lightbox img {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}

.lightbox figcaption {
  margin-top: var(--s-12);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  text-align: center;
}

.lightbox-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--fast) ease-out, background-color var(--fast) ease-out;
}

.lightbox-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-3);
}

.lightbox-close {
  top: var(--s-16);
  right: var(--s-16);
}

.lightbox-prev {
  left: var(--s-16);
  bottom: var(--s-16);
}

.lightbox-next {
  left: calc(var(--s-16) + 48px + var(--s-8));
  bottom: var(--s-16);
}

@media (min-width: 900px) {
  .lightbox-prev,
  .lightbox-next {
    bottom: auto;
    top: 50%;
  }

  .lightbox-prev {
    left: var(--s-24);
  }

  .lightbox-next {
    left: auto;
    right: var(--s-24);
  }
}
