/* Bloquea el scroll del body cuando el modal está abierto */
body.modal-open {
    overflow: hidden;
}

.botones {
    text-align: center;   /* centra los hijos inline-block */
    /*margin-top: 20px;*/
}

/*
#btnNuevoUsuario, #btnNuevoLector {
    display: inline-block;
    margin: 0 10px;       // espacio horizontal entre botones
    padding: 10px 20px;
    font-size: 1rem;
    background: gold;
    color: #1e1e2a;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
    width: auto;
}
#btnNuevoUsuario:hover, #btnNuevoLector:hover {
    background: #d4a514;
}
*/

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    overflow: hidden;
}

/* Contenido del modal */
.modal-content {
    background: #1e1e2a;
    margin: 30px auto;
    padding: 16px;
    border: 1px solid gold;
    border-radius: 8px;
    width: 50%;
    max-width: 600px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    color: #fff;
}

/* Inputs y select */
.modal-content input,
.modal-content select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid gold;
    border-radius: 5px;
    background: #333;
    color: #fff;
    font-size: 1rem;
}

/* Botón dentro del modal */
.modal-content button {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: gold;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}
.modal-content button:hover {
    background: #d4a514;
}

/* Botón cerrar */
.close {
    float: right;
    font-size: 24px;
    cursor: pointer;
    color: gold;
    font-weight: bold;
    margin-top: -10px;
    margin-right: -5px;
    transition: color 0.3s ease;
}
.close:hover {
    color: #d4a514;
}


/* ==========================================
   REPORTE DEL LECTOR
========================================== */

.modal-reporte-lector {
    width: 80%;
    max-width: 900px;
}

.modal-reporte-lector h2 {
    color: gold;
    margin-top: 0;
    margin-bottom: 20px;
}

.reporte-lector-datos {
    background: #333;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 12px;
    margin-bottom: 20px;
}

.reporte-lector-datos strong {
    color: gold;
}

#contenidoReporteLector {
    width: 100%;
    overflow-x: auto;
}

#contenidoReporteLector table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#contenidoReporteLector th {
    background: #333;
    color: gold;
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid gold;
}

#contenidoReporteLector td {
    padding: 10px;
    border-bottom: 1px solid #444;
    color: #fff;
}

#contenidoReporteLector tr:hover {
    background: #292936;
}

/*FIN DE REPORTE MODAL*/

/* Responsive para móviles */
@media (max-width: 768px) {
    .modal-content {
        width: 80%;
        margin: 20px auto;
        padding: 14px;
    }
    .modal-content input,
    .modal-content select {
        padding: 12px;
        margin: 8px 0;
        font-size: 1rem;
    }
    .modal-content button {
        padding: 12px;
        font-size: 1rem;
    }
}

/* ==========================================
   MODAL ASIGNAR LIBROS
========================================== */

.modal-content h2 {
    color: gold;
    margin-top: 0;
    margin-bottom: 20px;
}


/* Información del lector */

#modalLector-asignar #asignar_lector_nombre,
#modalLector-asignar #asignar_lector_email,
#modalLector-asignar #asignar_lector_telefono {
    color: #ddd;
}


/* ==========================================
   RESULTADOS DE LIBROS
========================================== */

#resultados_libros {
    margin-top: 15px;
}


.libro-resultado {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 10px;

    margin-bottom: 10px;

    background: #292936;

    border: 1px solid #444;

    border-radius: 8px;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}


.libro-resultado:hover {
    border-color: gold;
    background: #33333f;
}


.libro-resultado-portada {
    width: 50px;
    height: 68px;

    object-fit: cover;

    border-radius: 5px;

    flex-shrink: 0;
}


.libro-resultado-titulo {
    flex: 1;

    color: #fff;

    font-weight: bold;

    margin: 0;
}


.libro-resultado .libro-checkbox {
    width: 20px !important;
    height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    flex-shrink: 0;
    accent-color: gold;
}

/* ==========================================
   LIBROS SELECCIONADOS
========================================== */

#libros_seleccionados {
    margin-top: 15px;
}


.libro-seleccionado {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 10px;

    margin-bottom: 10px;

    background: #292936;

    border: 1px solid gold;

    border-radius: 8px;
}


.libro-seleccionado-portada {
    width: 50px;
    height: 68px;

    object-fit: cover;

    border-radius: 5px;

    flex-shrink: 0;
}


.libro-seleccionado-titulo {
    flex: 1;

    color: #fff;

    font-weight: bold;
}


/* Precio */

.libro-monto {
    width: 90px !important;

    padding: 8px !important;

    margin: 0 !important;
}


/* Botón quitar */

.libro-quitar {
    width: auto !important;

    margin: 0 !important;

    padding: 8px 12px !important;

    background: #555 !important;

    color: #fff;

    font-size: 0.9rem !important;
}


.libro-quitar:hover {
    background: #777 !important;
}


/* Contador */

#contador_libros_seleccionados {
    color: gold;

    padding: 8px 0;

    font-weight: bold;
}

@media (max-width: 768px) {

    .modal-reporte-lector {
        width: 90%;
    }

    #contenidoReporteLector table {
        min-width: 650px;
    }

}



/* ==========================================
   VISOR AMPLIADO DE PORTADAS
========================================== */

.book-cover-zoom {
    position: relative;
    cursor: zoom-in;
}

.book-cover-zoom img {
    cursor: zoom-in;
}

.book-cover-lupa {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 25px;
    cursor: zoom-in;
    z-index: 2;
}

.book-cover-lupa:hover {
    background: gold;
    color: #1e1e2a;
}

.portada-visor {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.portada-visor.activo {
    display: flex;
}

.portada-visor img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 90vw;
    max-height: 90vh;
    aspect-ratio: auto !important;
    object-fit: contain;
    object-position: center;
    border-radius: 6px;
}

.portada-visor-cerrar {
    position: absolute;
    top: 15px;
    right: 25px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    width: auto;
    padding: 5px 12px;
    z-index: 10001;
}

.portada-visor-cerrar:hover {
    color: gold;
}

@media (max-width: 768px) {
    .portada-visor {
        padding: 15px;
    }

    .portada-visor img {
        max-width: 96%;
        max-height: 85vh;
    }

    .portada-visor-cerrar {
        top: 8px;
        right: 10px;
    }
}

/* Botón circular para cerrar el modal */
.modal-content .close {
    position: absolute;
    top: 12px;
    right: 12px;

    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background: #333344;
    color: #ffffff;

    border: 1px solid #55556a;
    font-size: 25px;
    font-weight: normal;
    line-height: 1;

    cursor: pointer;
    opacity: 1;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

.modal-content .close:hover {
    background: #d4af37;
    color: #171717;
}

/* Campo de biografía del autor */
.modal-content .campo-biografia {
    width: 100%;
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.modal-content .campo-biografia label {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    text-align: left;
    font-weight: 600;
}

.modal-content .campo-biografia textarea {
    display: block;
    width: 80%;
    min-height: 180px;
    box-sizing: border-box;
    resize: vertical;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

/* ==========================================
   MODAL NUEVO LIBRO
========================================== */

#modalLibro .form-group {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#modalLibro .form-group label {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    text-align: left;
    font-weight: 600;
}

#modalLibro .form-group textarea {
    display: block;
    width: 80%;
    min-height: 180px;
    box-sizing: border-box;
    resize: vertical;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

#modalLibro .form-group input {
    box-sizing: border-box;
}

#modalLibro .modal-actions {
    margin-top: 20px;
}


/* MODAL EDITAR LIBRO */
#modalEditarLibro .modal-content {
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

#modalEditarLibro textarea {
    display: block;
    width: 100%;
    min-height: 150px;
    box-sizing: border-box;
    resize: vertical;
}

#modalEditarLibro input[type="text"],
#modalEditarLibro input[type="file"] {
    width: 100%;
    box-sizing: border-box;
}

#modalEditarLibro .form-group {
    width: 100%;
    margin-bottom: 16px;
}


/* BOTÓN CERRAR DENTRO DEL MODAL */
.modal-content {
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.modal-header .close {
    position: static;
    float: none;
    margin-left: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

/* ==========================================
   MODAL GESTIONAR OPCIONES DE COMPRA
========================================== */

#modalCompraLibro .modal-content {
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 25px;
}

#modalCompraLibro .modal-header h2 {
    color: gold;
    margin: 0;
    font-size: 1.4rem;
}

#modalCompraLibro .modal-body {
    width: 100%;
}

#modalCompraLibro .form-group {
    width: 100%;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#modalCompraLibro .form-group label {
    display: block;
    width: 100%;
    margin-bottom: 7px;
    color: #fff;
    font-weight: 600;
    text-align: left;
}

#modalCompraLibro .form-group input,
#modalCompraLibro .form-group textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 12px;
    border: 1px solid #777;
    border-radius: 5px;
    background: #333;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
}

#modalCompraLibro .form-group textarea {
    min-height: 130px;
    resize: vertical;
    line-height: 1.5;
}

#modalCompraLibro .form-group input:focus,
#modalCompraLibro .form-group textarea:focus {
    outline: none;
    border-color: gold;
}

#modalCompraLibro #listaOpcionesCompra {
    margin: 15px 0 25px;
}

#modalCompraLibro .opcion-compra-admin {
    padding: 15px;
    margin-bottom: 12px;
    background: #292936;
    border: 1px solid #555;
    border-radius: 7px;
}

#modalCompraLibro .opcion-compra-admin h4 {
    color: gold;
    margin: 0 0 8px;
}

#modalCompraLibro .opcion-compra-admin p {
    color: #ddd;
}

#modalCompraLibro .opcion-compra-admin button {
    width: auto;
    min-width: 110px;
    margin: 5px 8px 0 0;
    padding: 9px 16px;
}

#modalCompraLibro .modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

#modalCompraLibro .modal-footer button {
    width: auto;
    flex: 1;
    margin-top: 0;
}

#modalCompraLibro #cancelarEdicionCompra {
    background: #555;
    color: white;
}

#modalCompraLibro #cancelarEdicionCompra:hover {
    background: #777;
}

@media (max-width: 768px) {
    #modalCompraLibro .modal-content {
        width: 95%;
        margin: 15px auto;
        padding: 16px;
    }

    #modalCompraLibro .modal-footer {
        flex-direction: column;
    }

    #modalCompraLibro .modal-footer button {
        width: 100%;
    }
}
