/* ================================================
   PRODUCT SLIDE PANEL v4 — psp-style.css
   FIXES: z-index header, hover overlay, panel cerrar
   ================================================ */

/* ---- Lista de filas ---- */
.psp-list {
    width: 100%;
    margin: 0;
    padding: 0;
    border-top: 1px solid #d8d8d8;
}

.psp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 22px 4px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #d8d8d8;
    cursor: pointer;
    text-align: left;
    gap: 16px;
    font-family: inherit;
    box-sizing: border-box;
    /* Sin opacity en hover — solo cambio de color en label/chevron */
    transition: none;
}

/* Hover/estado activo: si el tema pinta el fondo oscuro, forzamos texto blanco */
.psp-row:hover,
.psp-row:focus-visible,
.psp-row[aria-expanded="true"] {
    background: #111 !important;
}
.psp-row:hover .psp-row-label,
.psp-row:hover .psp-row-chevron,
.psp-row:focus-visible .psp-row-label,
.psp-row:focus-visible .psp-row-chevron,
.psp-row[aria-expanded="true"] .psp-row-label,
.psp-row[aria-expanded="true"] .psp-row-chevron {
    color: #fff !important;
    opacity: 1 !important;
}

.psp-row-label {
    font-size: 16px;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1.3;
    flex: 1;
    transition: opacity 0.18s ease;
}

.psp-row-chevron {
    flex-shrink: 0;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    transition: opacity 0.18s ease;
}

/* ---- Variables ---- */
:root {
    --psp-top-offset: 0px;
}

/* ---- Overlay ---- */
.psp-overlay {
    position: fixed;
    top: var(--psp-top-offset);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100dvh - var(--psp-top-offset));
    background: rgba(0, 0, 0, 0.45);
    z-index: 100000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    cursor: pointer;
}
.psp-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ---- Panel lateral ---- */
.psp-panel {
    position: fixed;
    top: var(--psp-top-offset);
    right: 0;
    width: min(560px, 100vw);
    height: calc(100dvh - var(--psp-top-offset));
    min-height: calc(100dvh - var(--psp-top-offset));
    background: #fff;
    z-index: 100001;   /* siempre encima de todo */
    transform: translateX(110%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -2px 0 40px rgba(0,0,0,0.15);
    /* Compensar admin bar de WordPress en escritorio */
    padding-top: 0;
}



.psp-panel.open {
    transform: translateX(0);
}

.psp-panel-inner {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--psp-top-offset));
    overflow: hidden;
}

/* Header del panel */
.psp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    flex-shrink: 0;
    border-bottom: 1px solid #ebebeb;
    background: #fff;
    /* FIX: siempre visible en la parte superior del panel */
    position: sticky;
    top: 0;
    z-index: 2;
}

.psp-panel-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    flex: 1;
    padding-right: 16px;
}

/* FIX: boton cerrar mas visible y con mejor target */
.psp-close {
    background: #fff;
    border: 1.5px solid #c0c0c0;
    border-radius: 6px;
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: #1a1a1a;
    transition: border-color 0.2s, background 0.2s;
    padding: 0;
    z-index: 3;
}
.psp-close:hover {
    background: #f2f2f2;
    border-color: #888;
}
.psp-close svg {
    pointer-events: none; /* FIX: que el SVG no interfiera con el click */
}

/* Cuerpo del panel */
.psp-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 32px 40px;
    -webkit-overflow-scrolling: touch;
    color: #1a1a1a;
    font-size: 15px;
    line-height: 1.75;
}

/* Contenido tipografico */
.psp-panel-body h2,
.psp-panel-body h3,
.psp-panel-body h4 {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 20px 0 4px;
}
.psp-panel-body p {
    margin: 0 0 12px;
    color: #333;
    line-height: 1.7;
}
.psp-panel-body strong { font-weight: 700; }

/* Tabla de detalles estilo clave/valor */
.psp-panel-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.psp-panel-body table td,
.psp-panel-body table th {
    padding: 12px 0;
    border-bottom: 1px solid #ebebeb;
    font-size: 14px;
    vertical-align: top;
    text-align: left;
}
.psp-panel-body table td:first-child,
.psp-panel-body table th:first-child {
    color: #888;
    font-weight: 400;
    width: 45%;
    padding-right: 12px;
}
.psp-panel-body table td:last-child,
.psp-panel-body table th:last-child {
    font-weight: 700;
    color: #1a1a1a;
}
.psp-panel-body table tr:last-child td { border-bottom: none; }

/* Separador */
.psp-panel-body hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 24px 0;
}

/* Imagenes */
.psp-panel-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px 0;
    border-radius: 4px;
}

/* Listas */
.psp-panel-body ul,
.psp-panel-body ol {
    padding-left: 20px;
    margin: 0 0 14px;
    color: #333;
}
.psp-panel-body ul li,
.psp-panel-body ol li { margin-bottom: 5px; }

/* Links */
.psp-panel-body a { color: #1a1a1a; }

/* Botones de descarga */
.psp-panel-body .psp-dl-btn,
.psp-panel-body a.psp-dl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid #c8c8c8;
    border-radius: 6px;
    padding: 13px 18px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.2s;
    background: #fff;
}
.psp-panel-body .psp-dl-btn:hover { background: #f5f5f5; }

/* ---- Responsive movil ---- */
@media (max-width: 600px) {
    .psp-panel { width: 100vw; }
    .psp-panel-header { padding: 18px 20px; }
    .psp-panel-title { font-size: 17px; }
    .psp-panel-body { padding: 20px 20px 32px; }
    .psp-row { padding: 18px 4px; }
    .psp-row-label { font-size: 15px; }
}

/* ---- Accesibilidad ---- */
.psp-row:focus-visible,
.psp-close:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}


/* Scroll interno del panel mientras el sitio queda fijo */
body.psp-no-scroll {
    overflow: hidden !important;
    touch-action: none;
}

.psp-panel-body {
    overscroll-behavior: contain;
}
