
/*DISENO CSS ORIGINAL

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f4f6f8;
    color: #222;
    display: flex;
    justify-content: center;
    width: 100%;
    overflow-x: hidden;
}

.main-container {
    width: 100%;
    max-width: 100%;
    background: #f2dbc6;
    min-height: 100vh;
    padding: 12px;
}

 
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.icon-btn, .admin-btn {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.admin-btn {
    background-color: #111;
    color: #fff;
    border: none;
}

.logo-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #907153;
}

 
.search-bar-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
}

.search-input {
    flex: 1;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.filter-icon-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 16px;
}

 
.categories-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 12px;
    scrollbar-width: none;  
    -webkit-overflow-scrolling: touch;  
}

.categories-container::-webkit-scrollbar {
    display: none;  
}

.cat-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}

.cat-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

 
.slider-bar {
    width: 100%;
    height: 3px;
    background: #eee;
    border-radius: 2px;
    position: relative;
    margin-bottom: 16px;
}

.slider-thumb {
    width: 30%;
    height: 3px;
    background: #666;
    border-radius: 2px;
    position: absolute;
    left: 0;
}

 
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: #907153;
}

.dropdown-filter {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
}

 
.books-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}


 
.book-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

 
.book-image-placeholder {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.book-image-placeholder img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: #fff;
    border: 1px solid #ccc;
    font-size: 8px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 4px;
}

.book-name { font-size: 14px; font-weight: 700; color: #111; line-height: 1.25; margin-bottom: 2px; }
.book-author { font-size: 12px; color: #555; }
.book-genre { font-size: 11px; color: #777; margin-bottom: 4px; }
.book-price { font-size: 14px; font-weight: 800; color: #000; }


                              

.detail-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 5px;
}


.detail-image-placeholder {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 2 / 3;
    height: auto;
    margin: 0 auto;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-badge-large {
    background: #fff;
    border: 1px solid #ccc;
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 1px;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-title {
    font-size: 18px;
    font-weight: 800;
    color: #111;
}

.detail-author, .detail-genre {
    font-size: 13px;
    color: #666;
}

.detail-author span, .detail-genre span {
    color: #222;
    font-weight: 600;
}

.detail-price {
    font-size: 20px;
    font-weight: 900;
    color: #000;
    margin-top: 6px;
}

 
.synopsis-section {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.synopsis-section h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #333;
}

.synopsis-text {
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    text-align: justify;
}

 
.whatsapp-container {
    margin-top: 20px;
    margin-bottom: 10px;
    width: 100%;
}

.whatsapp-btn {
    display: block;
    width: 100%;
    background-color: #25D366;
    color: #ffffff;
    text-align: center;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
    transition: background-color 0.2s ease;
}

.whatsapp-btn:hover {
    background-color: #20ba5a;
    color: #ffffff;
    text-decoration: none;
}


@media (min-width: 700px) {
    .books-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .books-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

*/

/* Reseteo general y diseño base adaptable */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #fbfaf8;
    color: #483e3e;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

.main-container {
    width: 100%;
    max-width: 100%;
    background: #fbfaf8;
    min-height: auto;
    
    padding: 12px;
}

/* Cabecera optimizada para pantallas pequeñas */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.icon-btn, .admin-btn {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #483e3e;
}

.admin-btn {
    background-color: #483e3e;
    color: #fff;
    border: none;
}

/* Contenedor para el título y el logo alineados verticalmente */
.logo-title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Estilo para la imagen del logo, adaptada exactamente al ancho del título */
.site-logo {
    width: 100%;
    max-width: 480px; /* Ajusta este valor si necesitas que coincida exactamente con la longitud de tu título */
    height: auto;
    object-fit: contain;
    margin-bottom: 18px;
}

.logo-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #483e3e;
}

/* Barra de búsqueda fluida */
.search-bar-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
}

.search-input {
    flex: 1;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    color: #483e3e;
    background-color: #ffffff;
}

.filter-icon-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 16px;
    color: #483e3e;
}

/* Categorías con scroll horizontal táctil */
.categories-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 12px;
    scrollbar-width: none; /* Ocultar barra en Firefox */
    -webkit-overflow-scrolling: touch; /* Scroll fluido en iOS */
}

.categories-container::-webkit-scrollbar {
    display: none; /* Ocultar barra en Chrome/Safari */
}

.cat-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    color: #483e3e;
}

.cat-btn.active {
    background: #483e3e;
    color: #fff;
    border-color: #483e3e;
}

/* Barra decorativa deslizable */
.slider-bar {
    width: 100%;
    height: 3px;
    background: #eee;
    border-radius: 2px;
    position: relative;
    margin-bottom: 16px;
}

.slider-thumb {
    width: 30%;
    height: 3px;
    background: #483e3e;
    border-radius: 2px;
    position: absolute;
    left: 0;
}

/* Cabecera de sección */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: #483e3e;
}

.dropdown-filter {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    color: #483e3e;
}

/* Cuadrícula de libros adaptable a dos columnas ideales para móviles */
.books-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

/* Tarjeta: sin subrayado ni color de link */
.book-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

/* Portada con proporción de libro (2:3); la imagen la llena completa */
.book-image-placeholder {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.book-image-placeholder img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: #fff;
    border: 1px solid #ccc;
    font-size: 8px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 4px;
    color: #483e3e;
}

.book-name { font-size: 14px; font-weight: 700; color: #483e3e; line-height: 1.25; margin-bottom: 2px; }
.book-author { font-size: 12px; color: #483e3e; }
.book-genre { font-size: 11px; color: #483e3e; margin-bottom: 4px; opacity: 0.8; }
.book-price { font-size: 14px; font-weight: 800; color: #483e3e; }

/* Estilos específicos para la página de detalle */
.detail-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 5px;
}

.detail-image-placeholder {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 2 / 3;
    height: auto;
    margin: 0 auto;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-badge-large {
    background: #fff;
    border: 1px solid #ccc;
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 1px;
    color: #483e3e;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-title {
    font-size: 18px;
    font-weight: 800;
    color: #483e3e;
}

.detail-author, .detail-genre {
    font-size: 13px;
    color: #483e3e;
    opacity: 0.9;
}

.detail-author span, .detail-genre span {
    color: #483e3e;
    font-weight: 600;
}

.detail-price {
    font-size: 20px;
    font-weight: 900;
    color: #483e3e;
    margin-top: 6px;
}

/* Sección de sinopsis */
.synopsis-section {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.synopsis-section h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #483e3e;
}

.synopsis-text {
    font-size: 13px;
    line-height: 1.5;
    color: #483e3e;
    text-align: justify;
    opacity: 0.9;
}

/* Clases para el contenedor y botón de WhatsApp */
.whatsapp-container {
    margin-top: 20px;
    margin-bottom: 10px;
    width: 100%;
}

.whatsapp-btn {
    display: block;
    width: 100%;
    background-color: #25D366;
    color: #ffffff;
    text-align: center;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
    transition: background-color 0.2s ease;
}

.whatsapp-btn:hover {
    background-color: #20ba5a;
    color: #ffffff;
    text-decoration: none;
}

/* Media Queries */
@media (min-width: 700px) {
    .books-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .books-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* =========================================================
   PANEL DE ADMINISTRACIÓN (login, libros, proveedores)
   ========================================================= */

#formLogin,
#formAlta,
#formBusqueda,
#lista {
    background: #ffffff;
    border: 1px solid #e6e1da;
    border-radius: 12px;
    padding: 16px;
    margin: 0 auto 16px auto;
    max-width: 1100px;
    box-shadow: 0 2px 8px rgba(72, 62, 62, 0.06);
}

#formLogin h1,
#formAlta h1 {
    font-size: 18px;
    font-weight: 800;
    color: #483e3e;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* ---------- Formularios (h:panelGrid = <table>) ---------- */

#formLogin table,
#formAlta table {
    width: 100%;
    border-collapse: collapse;
}

#formLogin td,
#formAlta td {
    padding: 6px 4px;
    vertical-align: top;
    font-size: 14px;
    color: #483e3e;
}

#formLogin label,
#formAlta label {
    font-size: 13px;
    font-weight: 700;
    color: #483e3e;
}

#formLogin input[type="text"],
#formLogin input[type="password"],
#formAlta input[type="text"],
#formAlta select,
#formAlta textarea,
#formBusqueda input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #483e3e;
    background-color: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#formAlta textarea {
    resize: vertical;
    min-height: 90px;
}

#formLogin input:focus,
#formAlta input:focus,
#formAlta select:focus,
#formAlta textarea:focus,
#formBusqueda input:focus {
    border-color: #907153;
    box-shadow: 0 0 0 3px rgba(144, 113, 83, 0.18);
}

#formAlta input[type="file"] {
    width: 100%;
    font-size: 13px;
    color: #483e3e;
    padding: 8px;
    border: 1px dashed #c9bfb3;
    border-radius: 8px;
    background: #fbfaf8;
    cursor: pointer;
}

/* ---------- Botones ---------- */

#formLogin input[type="submit"],
#formAlta input[type="submit"],
#formBusqueda input[type="submit"],
#lista input[type="submit"] {
    background-color: #483e3e;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#formLogin input[type="submit"]:hover,
#formAlta input[type="submit"]:hover,
#formBusqueda input[type="submit"]:hover,
#lista input[type="submit"]:hover {
    background-color: #2f2828;
}

#formLogin input[type="submit"]:active,
#formAlta input[type="submit"]:active,
#formBusqueda input[type="submit"]:active,
#lista input[type="submit"]:active {
    transform: scale(0.97);
}

/* Botones de la tabla: más chicos y con jerarquía de colores */
#lista input[type="submit"] {
    padding: 6px 10px;
    font-size: 12px;
    margin: 2px 2px 2px 0;
}

#lista input[value="Seleccionar para Editar"] {
    background-color: #907153;
}
#lista input[value="Seleccionar para Editar"]:hover {
    background-color: #7a5f45;
}

#lista input[value="Dar de baja"] {
    background-color: #ffffff;
    color: #483e3e;
    border: 1px solid #483e3e;
}
#lista input[value="Dar de baja"]:hover {
    background-color: #f2ece5;
}

#lista input[value="Eliminar"] {
    background-color: #b3261e;
}
#lista input[value="Eliminar"]:hover {
    background-color: #8f1d17;
}

/* ---------- Mensajes de validación / error ---------- */

#formLogin .mensaje-error,
#formAlta .ui-messages,
.mensaje-error {
    color: #b3261e;
    font-size: 13px;
    font-weight: 600;
}

#formLogin ul,
#formAlta ul {
    list-style: none;
    margin-top: 10px;
}

#formLogin ul li,
#formAlta ul li {
    background: #fdecea;
    border: 1px solid #f5c2be;
    color: #b3261e;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 6px;
}

/* Mensajes junto a cada campo (h:message) */
#formLogin td span,
#formAlta td span {
    font-size: 12px;
    color: #b3261e;
}

/* ---------- Buscador de proveedores ---------- */

#formBusqueda {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#formBusqueda input[type="text"] {
    flex: 1;
    min-width: 160px;
    width: auto;
}

/* ---------- Tablas de listado (h:dataTable) ---------- */

#lista {
    padding: 0;
    overflow: hidden;
}

#lista table {
    display: block;              /* permite scroll horizontal en celular */
    overflow-x: auto;
    width: 100%;
    border-collapse: collapse;
    -webkit-overflow-scrolling: touch;
}

#lista thead,
#lista tbody {
    display: table;
    width: 100%;
    min-width: 700px;
}

#lista th {
    background: #483e3e;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    padding: 10px 12px;
    white-space: nowrap;
}

#lista td {
    padding: 10px 12px;
    font-size: 13px;
    color: #483e3e;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

#lista tbody tr:nth-child(even) {
    background: #fbfaf8;
}

#lista tbody tr:hover {
    background: #f2ece5;
}

#lista td img {
    display: block;
    width: 40px;
    height: auto;
    border-radius: 4px;
    object-fit: cover;
}

/* ---------- Login centrado y más compacto ---------- */

#formLogin {
    max-width: 380px;
    margin-top: 40px;
}

#formLogin td:first-child {
    width: 90px;
    white-space: nowrap;
}

#formLogin input[type="submit"] {
    width: 100%;
}

/* ---------- Celular: los campos se apilan (etiqueta arriba, campo abajo) ---------- */

@media (max-width: 600px) {
    #formLogin table,
    #formAlta table,
    #formLogin tbody,
    #formAlta tbody,
    #formLogin tr,
    #formAlta tr,
    #formLogin td,
    #formAlta td {
        display: block;
        width: 100%;
    }

    #formLogin td:first-child {
        width: 100%;
    }

    #formAlta td {
        padding: 3px 0;
    }

    #formAlta tr {
        margin-bottom: 8px;
    }

    #formAlta input[type="submit"] {
        width: 100%;
    }
}

/* ---------- Escritorio: formulario de alta con etiquetas alineadas ---------- */

@media (min-width: 700px) {
    #formAlta td:first-child {
        width: 130px;
        white-space: nowrap;
        padding-top: 14px;
    }

    #formAlta td:nth-child(2) {
        width: 60%;
    }
}

/* =========================================================
   LAYOUT DEL ADMIN (título + menú arriba, contenido abajo)
   ========================================================= */

.admin-body {
    flex-direction: column;      /* apila header, main y aside */
    align-items: center;
    padding: 12px;
}

.admin-body header,
.admin-body main {
    width: 100%;
    max-width: 1100px;
}

.admin-body aside:empty {
    display: none;
}

/* ---------- Título ---------- */

.admin-header {
    text-align: center;
    margin-bottom: 16px;
}

.admin-header h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #483e3e;
    margin-bottom: 10px;
}

/* ---------- Menú de navegación ---------- */

.admin-header form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0;                /* oculta los separadores "|" del layout */
}

.admin-header a {
    display: inline-block;
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #483e3e;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.admin-header a:hover {
    background: #483e3e;
    color: #ffffff;
    border-color: #483e3e;
}

.admin-header input[type="submit"] {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #b3261e;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #b3261e;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.admin-header input[type="submit"]:hover {
    background: #b3261e;
    color: #ffffff;
}

.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 16px;
    margin-top: 32px;
    border-top: 1px solid #ddd;
    text-align: center;
}

.footer-title {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.social-link {
    text-decoration: none;
    color: inherit;
    padding: 6px 12px;
    border: 1px solid currentColor;
    border-radius: 20px;
}

.footer-login {
    margin: 0;
}
.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 16px;
    margin-top: 32px;
    border-top: 1px solid #ddd;
    text-align: center;
    width: 100%;
    background: #fbfaf8;
}