/* ==========================================================================
   Panel del emprendedor (/<tienda>/wp-admin/): apariencia de WordPress 5.8 +
   WooCommerce, según las capturas de los manuales del CME en el Drive
   («Configuración del Sitio», «Configuración de Envíos», «Configuración de Packs»).
   ========================================================================== */

:root {
  --wp-negro: #1d2327;
  --wp-gris-menu: #2c3338;
  --wp-azul: #2271b1;
  --wp-azul-oscuro: #135e96;
  --wp-azul-claro: #72aee6;
  --wp-fondo: #f0f0f1;
  --wp-borde: #c3c4c7;
  --wp-texto: #1d2327;
  --wp-gris: #50575e;
  --wp-rojo: #b32d2e;
  --wp-verde: #00a32a;
  --woo-morado: #7f54b3;
  --fuente-wp: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }
body.wp {
  margin: 0; min-height: 100vh;
  background: var(--wp-fondo); color: var(--wp-texto);
  font: 13px/1.4em var(--fuente-wp);
}
.wp a { color: var(--wp-azul); text-decoration: underline; }
.wp a:hover { color: var(--wp-azul-oscuro); }
.wp h1 { margin: 0; font-size: 23px; font-weight: 400; line-height: 1.3; }
.wp h2 { margin: 0; font-size: 14px; font-weight: 600; }
.wp p { margin: 0 0 1em; }
.wp :focus-visible { outline: 2px solid var(--wp-azul); outline-offset: 1px; }
.wp svg { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }
.wp img { max-width: 100%; height: auto; }
.solo-lectores { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Aviso de la demostración: borde lima y fondo gris. */
.nota-demo { margin: 0 0 16px; padding: 14px 18px; border-left: 4px solid #97D700; border-radius: 3px; background: #F8F8F8; color: #4D4D4D; font-size: 15px; line-height: 1.5; }
.acceso .nota-demo { width: 100%; max-width: 320px; font-size: 13px; }

/* ---------- Barra de administración ---------- */
.barra-admin {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  height: 32px; padding: 0 8px; background: var(--wp-negro); color: #f0f0f1;
}
.barra-admin ul { display: flex; align-items: center; height: 100%; margin: 0; padding: 0; list-style: none; }
.barra-admin a, .barra-admin button {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px;
  border: 0; background: none; color: #f0f0f1; font: inherit; text-decoration: none; cursor: pointer;
}
.barra-admin a:hover, .barra-admin button:hover { background: var(--wp-gris-menu); color: var(--wp-azul-claro); }
.barra-admin svg { width: 18px; height: 18px; }
.barra-admin__usuario img { width: 18px; height: 18px; border-radius: 2px; background: #888; }

/* ---------- Estructura ---------- */
.wp-marco { display: flex; min-height: calc(100vh - 32px); }
.wp-menu { flex: 0 0 160px; width: 160px; background: var(--wp-negro); padding-bottom: 20px; }
.wp-menu ul { margin: 0; padding: 0; list-style: none; }
.wp-menu__item > a {
  position: relative; display: flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 0 8px 0 10px; color: #f0f0f1; font-size: 14px; text-decoration: none;
}
.wp-menu__item > a svg { color: #a7aaad; }
.wp-menu__item > a:hover { background: var(--wp-gris-menu); color: var(--wp-azul-claro); }
.wp-menu__item > a:hover svg { color: var(--wp-azul-claro); }
.wp-menu__item--actual > a { background: var(--wp-azul); color: #fff; }
.wp-menu__item--actual > a svg { color: #fff; }
.wp-menu__item--actual > a::after {
  content: ""; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  border: 8px solid transparent; border-right-color: var(--wp-fondo);
}
.wp-submenu { padding: 7px 0 8px; background: var(--wp-gris-menu); }
.wp-submenu a { display: block; padding: 5px 12px; color: rgba(240, 246, 252, .7); font-size: 13px; text-decoration: none; }
.wp-submenu a:hover { color: var(--wp-azul-claro); }
.wp-submenu a[aria-current="page"] { color: #fff; font-weight: 600; }
.wp-menu__separador { height: 9px; }

.wp-cuerpo { flex: 1; min-width: 0; }
.woo-cabecera {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 60px; padding: 0 20px; background: #fff; box-shadow: 0 1px 0 #dcdcde;
  font-size: 14px;
}
.woo-cabecera__accesos { display: flex; gap: 22px; color: var(--wp-gris); font-size: 12px; }
.woo-cabecera__accesos span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wp-contenido { padding: 20px 20px 60px; }
.wp-titulo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }

/* ---------- Componentes ---------- */
.wp-boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 30px; padding: 0 10px; border: 1px solid var(--wp-azul); border-radius: 3px;
  background: #f6f7f7; color: var(--wp-azul); font: 13px/2.15 var(--fuente-wp); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.wp .wp-boton { text-decoration: none; }
.wp-boton:hover { background: #f0f0f1; border-color: var(--wp-azul-oscuro); color: var(--wp-azul-oscuro); }
.wp-boton--primario { background: var(--wp-azul); color: #fff; }
.wp-boton--primario:hover { background: var(--wp-azul-oscuro); color: #fff; }
.wp-boton:disabled { border-color: #dcdcde; background: #f6f7f7; color: #a7aaad; cursor: default; }
.wp-boton--elementor { min-height: 40px; padding: 0 22px; border: 0; background: #0c8ac8; color: #fff; font-size: 15px; }
.wp-boton--elementor:hover { background: #0a76ab; color: #fff; }
.wp-enlace { padding: 0; border: 0; background: none; color: var(--wp-azul); font: inherit; text-decoration: underline; cursor: pointer; }
.wp-enlace--peligro { color: var(--wp-rojo); }

.wp-campo, .wp-area, .wp-select {
  min-height: 30px; padding: 0 8px; border: 1px solid #8c8f94; border-radius: 4px;
  background: #fff; color: #2c3338; font: 14px var(--fuente-wp);
}
.wp-area { width: 100%; min-height: 120px; padding: 8px; resize: vertical; }
.wp-campo--titulo { width: 100%; min-height: 40px; padding: 3px 8px; font-size: 1.7em; }
.wp-campo:focus, .wp-area:focus, .wp-select:focus { border-color: var(--wp-azul); box-shadow: 0 0 0 1px var(--wp-azul); outline: 0; }

.wp-caja { margin-bottom: 20px; background: #fff; border: 1px solid var(--wp-borde); box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.wp-caja__cabecera { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--wp-borde); }
.wp-caja__cabecera h2 { font-size: 14px; }
.wp-caja__cuerpo { padding: 12px; }
.wp-caja__pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid #dcdcde; background: #f6f7f7; }

.wp-aviso { margin: 0 0 15px; padding: 10px 12px; border-left: 4px solid var(--wp-verde); background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.wp-aviso--info { border-left-color: var(--wp-azul-claro); }
.wp-aviso--alerta { border-left-color: #dba617; background: #fcf9e8; }
.wp-aviso--error { border-left-color: #d63638; }
.wp-aviso p { margin: 0; }

.wp-tabla { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--wp-borde); box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.wp-tabla th, .wp-tabla td { padding: 8px 10px; text-align: left; vertical-align: top; }
.wp-tabla thead th { border-bottom: 1px solid var(--wp-borde); font-weight: 400; color: var(--wp-texto); }
.wp-tabla tbody tr:nth-child(odd) { background: #f6f7f7; }
.wp-tabla__imagen { width: 52px; }
.wp-tabla__imagen img, .wp-tabla__imagen .sin-imagen { width: 40px; height: 40px; object-fit: cover; }
.wp-tabla .sin-imagen { display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #E6E6E6, #B3B3B3); color: #fff; font-weight: 700; font-size: 12px; }
.wp-tabla__nombre a { font-weight: 600; text-decoration: none; }
.wp-acciones { margin-top: 4px; color: #a7aaad; font-size: 13px; visibility: hidden; }
.wp-tabla tr:hover .wp-acciones, .wp-tabla tr:focus-within .wp-acciones { visibility: visible; }
.wp-acciones a, .wp-acciones button { text-decoration: none; }
.existencias { color: #7ad03a; font-weight: 600; }
.existencias--no { color: #a44; }
.vacio { padding: 14px; }

.subsubsub { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; padding: 0; list-style: none; color: var(--wp-gris); }
.subsubsub a { text-decoration: none; }
.subsubsub a[aria-current="page"] { color: #000; font-weight: 600; }
.wp-herramientas { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }

/* Pestañas de WooCommerce › Ajustes y de las páginas de opciones */
.wp-pestanas { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 0 15px; padding: 0; border-bottom: 1px solid var(--wp-borde); list-style: none; }
.wp-pestanas a {
  display: block; margin-bottom: -1px; padding: 6px 12px; border: 1px solid var(--wp-borde);
  background: #dcdcde; color: var(--wp-gris); font-size: 14px; font-weight: 600; text-decoration: none;
}
.wp-pestanas a:hover { background: #fff; color: #3c434a; }
.wp-pestanas a[aria-current="page"] { border-bottom-color: var(--wp-fondo); background: var(--wp-fondo); color: #000; }
.wp-caja .wp-pestanas { padding: 0 12px; }
.wp-caja .wp-pestanas a[aria-current="page"] { border-bottom-color: #fff; background: #fff; }

/* Tablas de formulario (Ajustes) */
.form-table { width: 100%; border-collapse: collapse; }
.form-table th { width: 220px; padding: 20px 10px 20px 0; text-align: left; vertical-align: top; font-weight: 600; }
.form-table td { padding: 15px 10px; vertical-align: middle; }
.form-table .descripcion { margin: 4px 0 0; color: #646970; font-size: 13px; }

/* Interruptor activado/desactivado de WooCommerce */
.interruptor { position: relative; display: inline-block; width: 32px; height: 18px; }
.interruptor input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.interruptor span { position: absolute; inset: 0; border-radius: 10px; background: #ccc; transition: background .2s; pointer-events: none; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .2s; }
.interruptor input:checked + span { background: var(--woo-morado); }
.interruptor input:checked + span::after { left: 17px; }
.interruptor input:focus-visible + span { outline: 2px solid var(--wp-azul); outline-offset: 2px; }

/* ---------- Editor de producto ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.editor__barra { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid #dcdcde; border-bottom: 0; background: #f6f7f7; }
.editor__modos button { padding: 4px 10px; border: 1px solid #dcdcde; background: #f6f7f7; font: inherit; cursor: pointer; }
.editor__modos button[aria-pressed="true"] { background: #fff; border-bottom-color: #fff; }
.editor__formato { display: flex; gap: 8px; padding: 6px 8px; border: 1px solid #dcdcde; border-bottom: 0; background: #fff; color: #50575e; font-weight: 700; }
.editor .wp-area { border-radius: 0; }
.editor__palabras { padding: 4px 8px; border: 1px solid #dcdcde; border-top: 0; background: #f6f7f7; color: #646970; font-size: 12px; }

.datos-producto__cabecera { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.datos-producto { display: flex; min-height: 300px; }
.datos-producto__pestanas { flex: 0 0 170px; margin: 0; padding: 0; border-right: 1px solid #eee; background: #fafafa; list-style: none; }
.datos-producto__pestanas a { display: flex; align-items: center; gap: 6px; padding: 10px; border-bottom: 1px solid #eee; text-decoration: none; }
.datos-producto__pestanas a[aria-current="true"] { background: #eee; color: #50575e; }
.datos-producto__panel { flex: 1; min-width: 0; padding: 4px 0; }
.campo-woo { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px 12px; }
.campo-woo > label:first-child, .campo-woo > span:first-child { color: var(--wp-texto); }
.campo-woo .wp-campo { width: 100%; max-width: 320px; }
.campo-woo .ayuda { grid-column: 2; color: #646970; font-size: 12px; }
.campo-woo--arriba { align-items: start; }
.limites { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.limites .wp-campo { width: 70px; }

.pack-busqueda { position: relative; max-width: 420px; }
.pack-busqueda .wp-campo { width: 100%; }
.pack-resultados, .pack-elegidos { margin: 0; padding: 0; border: 1px solid #dcdcde; list-style: none; }
.pack-resultados li, .pack-elegidos li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid #f0f0f1; }
.pack-resultados em, .pack-elegidos em { color: #a7aaad; }
.pack-resultados button, .pack-elegidos button { width: 26px; height: 26px; border: 0; border-radius: 2px; background: #dcdcde; color: #3c434a; cursor: pointer; }
.pack-resultados button:hover { background: #ff6f00; color: #fff; }
.pack-elegidos button:hover { background: #d63638; color: #fff; }

.publicar p { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.publicar .wp-select { min-height: 26px; font-size: 13px; }
.categorias-lista { max-height: 200px; margin: 0; padding: 8px; overflow: auto; border: 1px solid #dcdcde; list-style: none; }
.categorias-lista li { margin-bottom: 6px; }
.imagen-producto img { width: 100%; height: auto; margin-bottom: 8px; }

/* ---------- Escritorio ---------- */
.escritorio { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.estado-woo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.estado-woo li { display: flex; align-items: center; gap: 12px; padding: 14px; border-top: 1px solid #f0f0f1; }
.estado-woo li:nth-child(odd) { border-right: 1px solid #f0f0f1; }
.estado-woo strong { display: block; color: var(--wp-azul); font-size: 18px; font-weight: 400; }
.estado-woo__icono { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; }
.pasos { margin: 0; padding: 0; list-style: none; }
.pasos li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f0f0f1; }

/* ---------- Opciones (ACF): Configuración de Emprendedor ---------- */
.opciones { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.acf-campo { padding: 15px 12px; border-top: 1px solid #eee; }
.acf-campo:first-child { border-top: 0; }
.acf-campo > label, .acf-campo > .acf-etiqueta { display: block; margin-bottom: 6px; font-weight: 600; }
.acf-campo .requerido { color: #d63638; }
.acf-campo .wp-campo { width: 100%; }
.acf-campo .descripcion { margin: 6px 0 0; color: #646970; }
.acf-boton { border: 1px solid #ccd0d4; margin-bottom: 12px; }
.acf-boton summary { padding: 8px 12px; background: #f9f9f9; font-weight: 600; cursor: pointer; }
.acf-imagen { display: flex; align-items: center; justify-content: center; max-width: 100%; min-height: 120px; background: #f0f0f1; }
.acf-imagen img { display: block; max-width: 100%; max-height: 260px; }
.acf-imagen--icono { width: 300px; height: 190px; }
.acf-imagen--icono img { width: 150px; }
.acf-imagen--logo { width: 200px; height: 200px; }
.selector-iconos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.selector-iconos button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 2px solid transparent; background: #f6f7f7; font-size: 11px; cursor: pointer; }
.selector-iconos button[aria-pressed="true"] { border-color: var(--wp-azul); background: #fff; }
.selector-iconos img { width: 70px; }

/* ---------- Envíos ---------- */
.zona-regiones { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 160px; overflow: auto; padding: 8px; border: 1px solid #8c8f94; border-radius: 4px; background: #fff; }
.zona-regiones label { display: flex; align-items: center; gap: 4px; }
.metodos-envio td { vertical-align: middle; }

/* ---------- Acceso (wp-login.php) ---------- */
.acceso { display: flex; flex-direction: column; align-items: center; padding: 8% 16px 40px; }
.acceso__logo img { display: block; width: 150px; height: auto; margin-bottom: 24px; }
.acceso form { width: 100%; max-width: 320px; padding: 26px 24px; background: #fff; border: 1px solid #c3c4c7; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.acceso label { display: block; margin-bottom: 3px; font-size: 14px; }
.acceso .wp-campo { width: 100%; min-height: 40px; margin-bottom: 16px; font-size: 20px; }
.acceso__pie { display: flex; justify-content: space-between; align-items: center; }
.acceso__enlaces { width: 100%; max-width: 320px; padding: 0 24px; font-size: 13px; }
.acceso__enlaces p { margin: 16px 0 0; }
.acceso__enlaces a { color: #50575e; text-decoration: none; }

/* Menú plegado con «Collapse menu». */
.menu-plegado .wp-menu { flex-basis: 36px; width: 36px; }
.menu-plegado .wp-menu__item > a span, .menu-plegado .wp-submenu { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .wp-menu { flex-basis: 36px; width: 36px; }
  .wp-menu__item > a span, .wp-submenu { display: none; }
  .editor, .opciones, .escritorio { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .datos-producto { flex-direction: column; }
  .datos-producto__pestanas { display: flex; flex-wrap: wrap; flex-basis: auto; }
  .campo-woo { grid-template-columns: 1fr; }
  .campo-woo .ayuda { grid-column: 1; }
  .form-table th, .form-table td { display: block; width: auto; padding: 8px 0; }
}

/* ---------- Celular (como WordPress por debajo de 782 px) ---------- */
.barra-admin { white-space: nowrap; }
@media (max-width: 782px) {
  /* Barra superior: solo íconos a la izquierda; a la derecha, la guía y «Salir». */
  .barra-admin { height: 46px; padding: 0 4px; gap: 4px; }
  .barra-admin a, .barra-admin button { height: 46px; padding: 0 9px; }
  .barra-admin ul:first-child a { font-size: 0; gap: 0; }
  .barra-admin ul:first-child svg { width: 22px; height: 22px; }
  .barra-admin ul:last-child span { display: none; }
  .barra-admin ul:last-child li:first-child a { font-size: 0; }
  .barra-admin ul:last-child li:first-child a::before { content: "← Guía"; font-size: 13px; }
  .wp-marco { min-height: calc(100vh - 46px); }

  .wp-contenido { padding: 14px 12px 50px; }
  .woo-cabecera { min-height: 46px; padding: 8px 12px; }
  .woo-cabecera__accesos { display: none; }
  .wp h1 { font-size: 21px; }
  .wp-pestanas a { padding: 6px 9px; font-size: 13px; }
  .wp-herramientas form { display: flex; gap: 6px; width: 100%; }
  .wp-herramientas form .wp-campo { flex: 1; min-width: 0; }

  /* Campos: nunca más anchos que la pantalla (algunos traen ancho fijo). */
  .wp-contenido .wp-campo, .wp-contenido .wp-area, .wp-contenido .wp-select { max-width: 100%; min-height: 40px; font-size: 16px; }
  .wp-contenido .limites .wp-campo { min-height: 34px; }
  .form-table, .form-table > tbody, .form-table > tbody > tr { display: block; }
  .form-table th, .form-table td { display: block; width: auto; padding: 6px 0; }
  .form-table > tbody > tr { margin-bottom: 10px; }

  /* Tablas apiladas: una ficha por fila, con el título de cada columna. */
  .wp-tabla, .wp-tabla > tbody, .wp-tabla > tfoot, .wp-tabla > tbody > tr, .wp-tabla > tfoot > tr { display: block; }
  .wp-tabla > thead { display: none; }
  .wp-tabla > tbody > tr { padding: 10px 12px; border-bottom: 1px solid #dcdcde; }
  .wp-tabla > tbody > tr::after { content: ""; display: block; clear: both; }
  .wp-tabla > tbody > tr > td, .wp-tabla > tfoot > tr > td { display: block; width: auto; padding: 3px 0; }
  .wp-tabla > tbody > tr > td[data-titulo] { clear: both; }
  .wp-tabla > tbody > tr > td[data-titulo]::before { content: attr(data-titulo) ": "; font-weight: 600; color: #50575e; }
  .wp-tabla > tbody > tr > td.wp-tabla__imagen { float: left; margin: 0 10px 4px 0; }
  .wp-tabla > tbody > tr > td.wp-tabla__nombre::before { content: none; }
  .wp-tabla > tbody > tr > td.wp-tabla__nombre { clear: none; font-size: 14px; }
  .wp-tabla > tfoot > tr { padding: 10px 12px; }
  .wp-tabla .wp-campo { width: 100%; }
  .wp-acciones { visibility: visible; line-height: 1.9; }

  .estado-woo { grid-template-columns: 1fr; }
  .estado-woo li:nth-child(odd) { border-right: 0; }
  .pasos li { flex-wrap: wrap; }
  .zona-regiones { max-height: 220px; }
  .acf-imagen--icono { width: 100%; }
  .wp-caja__pie { flex-wrap: wrap; }
}
