/* Forzar el wrapper de Omeka a expandirse cuando contiene nuestro visor */
.media-render:has(.simpleepub-wrap) {
    width: 50vw !important;
    min-width: 320px !important;
}

.simpleepub-wrap {
    width: 100%;
    box-sizing: border-box;
}

#epub-controls,
#epub-container {
    width: 100%;
    box-sizing: border-box;
}

#epub-container {
    position: relative;
    height: 75vh;
    display: flex;
    overflow: hidden;
    background: #f5f1ea;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.08);
}

#epub-viewer {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* TOC como overlay para no robarle ancho al iframe de epub.js */
#epub-toc {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    width: 280px;
    height: 100%;
    overflow-y: auto;
    background: #fafafa;
    border-right: 1px solid #ddd;
    padding: 16px;
    box-sizing: border-box;
    box-shadow: 2px 0 8px rgba(0,0,0,0.12);
}

#epub-toc[hidden] {
    display: none;
}

#epub-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#epub-toc ul ul {
    padding-left: 14px;
    margin-top: 4px;
}

#epub-toc li {
    margin: 6px 0;
}

#epub-toc a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    display: block;
}

#epub-toc a:hover,
#epub-toc a:focus {
    text-decoration: underline;
    color: #000;
}

#epub-controls {
    background: #3F3F3F;
    color: #EEE;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#epub-controls > div {
    display: flex;
    align-items: center;
}

#epub-controls button {
    color: #FFF;
    padding: 6px 10px;
    background: none;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    box-shadow: none;
    margin: 0 2px;
    opacity: 0.75;
    transition: opacity 0.3s ease;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

#epub-controls button:hover,
#epub-controls button:focus-visible {
    opacity: 1;
    outline: 2px solid #888;
    outline-offset: 2px;
}

#epub-location {
    margin: 0 12px;
    color: #EEE;
    font-size: 13px;
    min-width: 5ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

#epub-download {
    color: #FFF;
    padding: 6px 10px;
    opacity: 0.75;
    transition: opacity 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
}

#epub-download:hover,
#epub-download:focus-visible {
    opacity: 1;
    outline: 2px solid #888;
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .media-render:has(.simpleepub-wrap) {
        width: 100% !important;
        min-width: 0 !important;
    }
}
