/* Contenedor principal del lector */
#map-reader-container {
    max-width: 800px;
    margin: 20px auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box; /* Asegura que los márgenes no alteren el tamaño */
}

/* Área donde se muestra el libro, con márgenes internos */
#map-book-viewport {
    position: relative;
    width: 100%;
    height: 65vh;
    min-height: 450px;
    max-height: 700px;
    background: #fafafa;
    overflow-x: hidden;
    padding: 10px 15px; /* MÁRGENES INTERNOS PARA QUE EL TEXTO NO TOQUE LOS BORDES */
}

#map-book {
    width: 100%;
    height: 100%;
}

#map-book iframe {
    max-width: 100% !important;
}

#map-book img {
    max-width: 100% !important;
    height: auto !important;
}

/* Indicador de carga */
#map-loading-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 15px;
    color: #666;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    z-index: 10;
}

/* Controles de navegación */
.map-reader-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    gap: 8px;
    box-sizing: border-box;
}

.map-btn {
    background-color: #9d7a42;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.map-btn:hover {
    background-color: #836332;
}

.map-btn-alt {
    background-color: #4a4a4a;
}

.map-btn-alt:hover {
    background-color: #2b2b2b;
}

/* Estilos aplicados en Modo Pantalla Completa (API NATIVA) */
#map-reader-container.map-fullscreen-mode {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important; /* Asegura que el contenedor llegue al borde físico */
}

/* AQUÍ ESTÁ EL ARREGLO CLAVE PARA EVITAR TEXTO CORTADO EN PANTALLA COMPLETA */
#map-reader-container.map-fullscreen-mode #map-book-viewport {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    padding: 15px 25px; /* MÁRGENES MÁS GRANDES EN MODO EXPANDIDO PARA PERFECTA LECTURA */
}

#map-reader-container.map-fullscreen-mode .map-reader-controls {
    flex: 0 0 auto !important;
}

/* Responsivo celular */
@media (max-width: 600px) {
    .map-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}