/* ═══════════════════════════════════════════════════════════════════
   WhatsFire — capa visual 2027 (se carga DESPUÉS de app.css)
   · Iconos SVG (Lucide) en lugar de emojis
   · Correcciones responsive (móvil y PC)
   · Microinteracciones suaves (respetan "reducir movimiento")
   ═══════════════════════════════════════════════════════════════════ */

/* ── Iconos ─────────────────────────────────────────────────────── */
svg.i { display: inline-block; width: 1em; height: 1em; vertical-align: -0.14em; flex-shrink: 0; }
.alert svg.i, .btn svg.i, .badge svg.i { vertical-align: -0.16em; }
.alert > svg.i:first-child { margin-top: 2px; }

/* Llama decorativa (antes era un emoji en CSS) */
.download-hero::after,
.dl-cta-box::after {
  content: '' !important;
  width: 9rem; height: 9rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4' /%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4' /%3E%3C/svg%3E") center / contain no-repeat;
  color: #fff; opacity: .07 !important; font-size: 0 !important;
}

/* ── Grillas que no desbordan ───────────────────────────────────── */
.bento-grid > *, .pricing-plans-grid > *, .app-layout > *, .card, .stat-card { min-width: 0; }
.license-key-text, code, .device-meta { overflow-wrap: anywhere; word-break: break-word; }
.table-wrap, .card table { max-width: 100%; }
.card:has(> table), .card:has(table) { overflow-x: auto; }

@media (max-width: 640px) {
  .bento-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .pricing-plans-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 18px !important; }
}

/* ── Escritorio: más aire y contenido centrado ──────────────────── */
@media (min-width: 1280px) {
  .main-content { padding: 40px 48px; }
  .main-content > * { max-width: 1240px; }
}

/* ── Tarjetas: profundidad y movimiento sutil ───────────────────── */
.card, .stat-card, .pricing-card, .device-card {
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
@media (hover: hover) {
  .stat-card:hover, .pricing-card:hover, .device-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px -12px rgba(13, 33, 55, .18);
  }
}
.pricing-card.popular { box-shadow: 0 18px 50px -18px rgba(46, 204, 143, .45); }

/* ── Botones: foco visible y estados claros ─────────────────────── */
.btn { gap: 8px; }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(46, 204, 143, .55); outline-offset: 2px;
}
.btn:active { transform: translateY(1px); }

/* ── Móvil ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-inner { gap: 10px; padding: 0 14px; }
  .navbar-user .truncate { display: none; }           /* solo el avatar */
  .navbar .btn-sm { padding: 8px 12px; }
  .main-content { padding: 18px 14px 90px; }
  .page-header h1 { font-size: 1.45rem; }
  .download-hero { padding: 26px 20px !important; border-radius: 18px !important; }
  .download-hero h2 { font-size: 1.2rem !important; line-height: 1.3; }
  .download-hero .btn, .download-hero .btn-lg { width: 100%; justify-content: center; white-space: normal; }
  .license-box { padding: 16px; }
  .card, .stat-card { padding: 18px; border-radius: 16px; }
  .stat-value { font-size: 1.6rem; }
  /* Objetivos táctiles ≥ 44 px */
  .btn, .sidebar-link, .form-control, select, input[type="text"], input[type="email"],
  input[type="password"], input[type="number"], input[type="date"] { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  /* Formularios en una columna */
  form[style*="display:flex"] { flex-direction: column; align-items: stretch !important; }
  form[style*="display:flex"] > * { width: 100%; min-width: 0 !important; }
  .device-card { flex-wrap: wrap; gap: 12px; }
  .alert { font-size: .9rem; }
}

/* Menú lateral convertido en barra inferior deslizable en móvil */
@media (max-width: 768px) {
  .sidebar.sidebar-open {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 90;
    height: auto; max-height: 70vh; flex-direction: column; overflow-y: auto;
    border-radius: 20px 20px 0 0; box-shadow: 0 -18px 50px rgba(13, 33, 55, .25);
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    animation: wf-sheet .28s ease-out;
  }
  .sidebar.sidebar-open .sidebar-section { flex-direction: column; }
  .sidebar.sidebar-open .sidebar-label { display: block; }
}
@keyframes wf-sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Entrada suave del contenido ────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .main-content > *, .auth-card, .pricing-card {
    animation: wf-rise .45s cubic-bezier(.2, .8, .2, 1) both;
  }
  .main-content > *:nth-child(2) { animation-delay: .04s; }
  .main-content > *:nth-child(3) { animation-delay: .08s; }
  .main-content > *:nth-child(4) { animation-delay: .12s; }
  .pricing-card:nth-child(2) { animation-delay: .06s; }
  .pricing-card:nth-child(3) { animation-delay: .12s; }
  .pricing-card:nth-child(4) { animation-delay: .18s; }
}
@keyframes wf-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ── Botón de menú flotante (móvil) ─────────────────────────────── */
.wf-menu-fab { display: none; }
@media (max-width: 768px) {
  .wf-menu-fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 95;
    width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
    background: linear-gradient(135deg, var(--mint, #2ECC8F), var(--mint-dark, #1aad74));
    color: #fff; font-size: 1.35rem; box-shadow: 0 12px 30px -8px rgba(26, 173, 116, .6);
  }
  .wf-backdrop { position: fixed; inset: 0; background: rgba(13, 33, 55, .35); backdrop-filter: blur(2px);
    z-index: 85; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .wf-backdrop.on { opacity: 1; pointer-events: auto; }
}

/* Ajustes finos móvil */
@media (max-width: 768px) {
  .sidebar.sidebar-open { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .device-card { align-items: flex-start; }
  .device-card .device-info { flex: 1 1 calc(100% - 60px); min-width: 0; }
  .device-card > div:last-child { width: 100%; justify-content: space-between; }
  .device-name { overflow-wrap: anywhere; }
}

/* ── Tablas en móvil: cada fila se muestra como tarjeta (wf-ui.js añade .wf-rt y data-label) ── */
@media (max-width: 768px) {
  table.wf-rt { display: block !important; overflow: visible !important; border: 0 !important; background: transparent !important; width: 100% !important; min-width: 0 !important; }
  table.wf-rt thead { display: none !important; }
  table.wf-rt tbody, table.wf-rt tfoot { display: block !important; }
  /* Sin !important: así se respetan las filas ocultas por filtros (style="display:none") */
  table.wf-rt tr { display: block; position: relative; background: #fff; border: 1px solid #DDE3F0; border-radius: 12px;
    padding: 6px 12px; margin-bottom: 10px; box-shadow: 0 2px 10px rgba(27, 43, 94, .05); }
  table.wf-rt td { display: flow-root !important;
    padding: 8px 0 !important; border: 0 !important; border-bottom: 1px dashed #E8EDF8 !important; text-align: right !important;
    min-width: 0; white-space: normal !important; overflow-wrap: anywhere; word-break: break-word; max-width: none !important; width: auto !important; }
  table.wf-rt td:last-child { border-bottom: 0 !important; }
  table.wf-rt td::before { content: attr(data-label); float: left; width: 36%; margin-right: 10px; text-align: left; font-size: .72rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #6B7A99; padding-top: 2px; }
  table.wf-rt td:not([data-label])::before, table.wf-rt td[data-label=""]::before { display: none; }
  table.wf-rt td:not([data-label]), table.wf-rt td[data-label=""], table.wf-rt td[colspan] { text-align: center !important; }
  table.wf-rt td > div, table.wf-rt td > form, table.wf-rt td > .badge { margin-left: auto; }
  table.wf-rt td > div + div { margin-top: 2px; }
  table.wf-rt tr[hidden], table.wf-rt tr.expand-row:not(.open), table.wf-rt tr.detail-row:not(.open) { display: none; }
  table.wf-rt tr.expand-row.open, table.wf-rt tr.detail-row.open { display: block; }
  table.wf-rt tr.expand-row { margin-top: -6px; background: #F9FAFF; }
  table.wf-rt tr.expand-row > td { display: block !important; text-align: left !important; }
  table.wf-rt tr.expand-row > td [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  /* Celda sin título (p. ej. botón para desplegar): a la esquina de la tarjeta */
  table.wf-rt td[data-label=""]:first-child { position: absolute; top: 8px; right: 10px; padding: 0 !important; border: 0 !important; z-index: 1; }
  table.wf-rt td[data-label=""]:first-child:empty { display: none !important; }
  table.wf-rt td[data-label=""]:first-child + td { padding-right: 48px !important; }
  table.wf-rt td > * { max-width: 100%; }
  table.wf-rt td form, table.wf-rt td .actions, table.wf-rt td .btn-group { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  table.wf-rt td input, table.wf-rt td select { max-width: 100%; }
  /* Las tablas ya no necesitan desplazamiento lateral en su contenedor */
  .table-wrap:has(> table.wf-rt), .tbl-wrap:has(> table.wf-rt), .card:has(table.wf-rt) { overflow-x: visible !important; }
}

/* Botones de los planes: el texto largo baja de línea en vez de cortarse */
.pricing-card .btn, .pricing-card .btn-paypal, .pricing-card button, .plan-card .btn, .pc .btn-cta {
  white-space: normal !important; height: auto !important; min-height: 44px; line-height: 1.25 !important;
  text-align: center; overflow-wrap: anywhere; }
.pricing-card .btn svg.i, .pricing-card button svg.i { flex-shrink: 0; }
@media (max-width: 768px) { table.wf-rt tr.wf-rt-head { display: none; } }
