/* CreaTV — Device Config: ícono discreto + modal de configuración */

/* ── Ocultar engranaje cuando la app corre como app instalada ─────────
   El engranaje sirve para ofrecer "Instalar app" / "Pin to TV" / etc.
   Si la app YA está instalada (TWA Android APK, APK Android TV, PWA
   standalone en Chrome/Edge, home-screen iOS) ofrecer instalar es
   redundante y confunde. Solo se muestra cuando la app corre como
   página web normal en un navegador.

   Cubre: APK Android (TWA, display-mode standalone/fullscreen),
          APK Android TV (display-mode standalone),
          PWA Chrome/Edge desktop instalada (standalone),
          iOS Safari home-screen (la clase .is-standalone-ios del JS). */
@media (display-mode: standalone),
       (display-mode: fullscreen),
       (display-mode: minimal-ui) {
  #btn-device-config { display: none !important; }
  #device-config-modal { display: none !important; }
}
html.is-standalone-ios #btn-device-config,
html.is-standalone-ios #device-config-modal {
  display: none !important;
}

/* ── Ícono discreto top-right del splash ─────────────────────── */
#btn-device-config {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 28, 26, 0.55);
  border: 1px solid rgba(232, 245, 242, 0.10);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.2s ease;
  z-index: 30;
  padding: 0;
}
#btn-device-config:hover,
#btn-device-config.focused {
  color: var(--accent-focus);
  border-color: var(--accent-focus);
  transform: rotate(45deg);
}
#btn-device-config svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* ── Modal de configuración ──────────────────────────────────── */
#device-config-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#device-config-modal.visible {
  display: flex;
  opacity: 1;
}

.dc-card {
  background: rgba(13, 28, 26, 0.92);
  border: 1px solid rgba(232, 245, 242, 0.12);
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.dc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(232, 245, 242, 0.06);
}
.dc-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  margin: 0;
}
.dc-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
  line-height: 1;
}
.dc-close:hover { background: rgba(255, 255, 255, 0.10); color: var(--text-primary); }

.dc-device {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: rgba(107, 170, 160, 0.06);
  border-bottom: 1px solid rgba(232, 245, 242, 0.06);
}
.dc-device-icon {
  font-size: 28px;
  width: 40px;
  text-align: center;
}
.dc-device-text {
  flex: 1;
  min-width: 0;
}
.dc-device-label {
  font-size: 12px; /* mínimo legible: subido desde 11 px */
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.dc-device-name {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2px;
}

/* UA debug — útil cuando un TV no se detecta correctamente. Truncado por
   defecto, se expande con un toque/click para ver el User-Agent completo. */
.dc-device-ua {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  letter-spacing: 0;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
.dc-device-ua:hover { opacity: 1; }
.dc-device-ua.expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-all;
  opacity: 1;
}

.dc-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 245, 242, 0.18) transparent;
}
.dc-list::-webkit-scrollbar { width: 6px; }
.dc-list::-webkit-scrollbar-thumb { background: rgba(232, 245, 242, 0.18); border-radius: 3px; }

.dc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  margin: 2px 0;
  transition: background 0.12s ease;
}
.dc-item:hover { background: rgba(255, 255, 255, 0.03); }
.dc-item.dc-disabled { opacity: 0.45; }

.dc-item-info { flex: 1; min-width: 0; }
.dc-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

/* Badge "Recomendado" al lado del título — usado por la opción APK Android */
.dc-item-recommended {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(212, 236, 90, 0.15);
  color: var(--accent-focus);
  border: 1px solid rgba(212, 236, 90, 0.30);
  border-radius: 999px;
  text-transform: uppercase;
  vertical-align: middle;
}
.dc-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

/* Estado: badge a la derecha */
.dc-status {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}
.dc-status.applied  { background: rgba(77, 201, 138, 0.12); color: var(--accent-success); }
.dc-status.pending  { background: rgba(232, 160, 48, 0.12); color: var(--accent-warning); }
.dc-status.action   { background: rgba(212, 236, 90, 0.12); color: var(--accent-focus); cursor: pointer; border: 1px solid rgba(212, 236, 90, 0.25); }
.dc-status.action:hover { background: rgba(212, 236, 90, 0.18); }
.dc-status.unavailable { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }

/* Hint de instalación manual (iOS/TV) */
.dc-hint {
  margin: 4px 14px 12px;
  padding: 10px 14px;
  background: rgba(122, 175, 192, 0.08);
  border-left: 3px solid var(--accent-info);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.dc-hint strong { color: var(--text-primary); }

.dc-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(232, 245, 242, 0.06);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.dc-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.4px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.dc-btn-primary {
  background: var(--crea-teal);
  color: var(--bg-primary);
}
.dc-btn-primary:hover { background: var(--crea-mint); }
.dc-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(232, 245, 242, 0.12);
}
.dc-btn-ghost:hover { color: var(--text-primary); border-color: rgba(232, 245, 242, 0.25); }

/* Responsive */
@media (max-width: 480px) {
  #btn-device-config { width: 36px; height: 36px; top: 12px; right: 12px; }
  .dc-card { max-height: 92vh; }
  .dc-header h2 { font-size: 16px; }
  .dc-item-title { font-size: 13px; }
  .dc-item-desc  { font-size: 11px; }
}

/* ─────────────────────────────────────────────────────────────────────
   Cards de instalación clickeables completas (v30)
   El usuario hace click en CUALQUIER parte del card y dispara el download.
   Sin botón "Aplicar" separado — el card entero es la zona activa.
   ───────────────────────────────────────────────────────────────────── */
.dc-list .dc-card {
  display: grid;
  grid-template-columns: 56px 1fr 24px;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(232, 245, 242, 0.10);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 160ms ease-out, border-color 160ms ease-out, transform 100ms ease-out;
  list-style: none;
}
.dc-list .dc-card:hover:not(.dc-disabled) {
  background: rgba(212, 236, 90, 0.07);
  border-color: rgba(212, 236, 90, 0.40);
  transform: translateY(-1px);
}
.dc-list .dc-card:active:not(.dc-disabled) {
  transform: translateY(0);
  background: rgba(212, 236, 90, 0.12);
}
.dc-list .dc-card:focus-visible {
  outline: 2px solid var(--accent-focus, #D4EC5A);
  outline-offset: 2px;
}
.dc-list .dc-card.dc-recommended {
  border-color: rgba(212, 236, 90, 0.45);
  background: rgba(212, 236, 90, 0.06);
}
.dc-list .dc-card.dc-applied {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.06);
}
.dc-list .dc-card.dc-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dc-card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}
.dc-card-body {
  min-width: 0;
}
.dc-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.dc-card-desc {
  font-size: 13px;
  color: var(--text-secondary, rgba(255,255,255,0.65));
  line-height: 1.4;
}
.dc-card-chevron {
  font-size: 28px;
  color: rgba(232, 245, 242, 0.35);
  font-weight: 300;
  line-height: 1;
  transition: transform 160ms ease-out, color 160ms ease-out;
}
.dc-list .dc-card:hover:not(.dc-disabled) .dc-card-chevron {
  transform: translateX(3px);
  color: var(--accent-focus, #D4EC5A);
}

.dc-card-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.dc-badge-recommended {
  background: rgba(212, 236, 90, 0.18);
  color: #d4ec5a;
}
.dc-badge-applied {
  background: rgba(74, 222, 128, 0.18);
  color: #4ade80;
}
.dc-badge-unavailable {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232, 245, 242, 0.45);
}

/* TV / 10-foot: cards más grandes para legibilidad */
@media (min-width: 1280px) and (min-height: 720px) {
  .dc-list .dc-card { padding: 22px 22px; grid-template-columns: 72px 1fr 28px; gap: 18px; }
  .dc-card-icon    { width: 72px; height: 72px; font-size: 40px; }
  .dc-card-title   { font-size: 20px; }
  .dc-card-desc    { font-size: 15px; }
}
@media (max-width: 480px) {
  .dc-list .dc-card { padding: 14px 12px; grid-template-columns: 44px 1fr 20px; gap: 10px; }
  .dc-card-icon    { width: 44px; height: 44px; font-size: 26px; }
  .dc-card-title   { font-size: 14px; }
  .dc-card-desc    { font-size: 12px; }
}
