:root {
    --toolbar-height: 60px;
    --toolbar-mobile-height: 100px;
    --viewer-ratio: calc(2 / 1); /* Proporcion 2:1 */
}

* {
    box-sizing: border-box;
}

/* Contenedor principal con proporcion 2:1 */
.viewer-container {
    width: 775px;
    height: 70vh; /* Altura inicial */
    min-height: 500px; /* Altura mínima */
    max-height: 90vh; /* Altura máxima */
    display: flex;
    flex-direction: column;
    background-color: #e0e0e0;
    margin: 20px 0;
    border-radius: 4px;
    overflow: hidden;
}

/* Barra de herramientas reorganizada */
.toolbar {
    background-color: #333;
    color: white;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    min-height: var(--toolbar-height);
}

/* Grupos de botones en fila */
.toolbar-row {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Botones ajustados */
.toolbar button {
    background-color: #555;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px;
    min-width: 36px;
    flex-shrink: 0;
}

.toolbar button:hover {
    background-color: #777;
}

.page-input {
    width: 70px;
    text-align: center;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.separator {
    height: 24px;
    width: 1px;
    background-color: #666;
    margin: 0 4px;
    flex-shrink: 0;
}

/* Contenedor del PDF ajustado a la proporcion */
.pdf-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background-color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.pdf-content {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease-out;
    cursor: grab;
    max-width: 100%;
    padding: 20px;
}

.pdf-content.grabbing {
    cursor: grabbing;
}

.page {
    background-color: white;
    margin: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.double-page {
    display: flex;
    margin: 10px;
}

.thumbnail-grid {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px;
    gap: 10px;
    overflow-y: auto;
    height: 100%;
}

.thumbnail {
    width: 120px;
    height: 160px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
    background-color: white;
}

.thumbnail:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.status-info {
    color: #ddd;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    margin-left: auto;
    padding-right: 10px;
}

.zoom-level {
    width: 50px;
    text-align: center;
    font-size: 14px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-fade {
    animation: fadeIn 0.3s ease-in-out;
}

/* Estilos para moviles */

@media (max-width: 1200px) {
    .viewer-container {
        width: 640px;
    }

@media (max-width: 768px) {
    .viewer-container {
        width: 480px;
        aspect-ratio: unset;
        height: auto;
    }
    
    .toolbar {
        min-height: var(--toolbar-mobile-height);
        gap: 4px;
        padding: 6px 8px;
    }
    
    .toolbar-row {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .toolbar-group {
        gap: 4px;
    }
    
    .toolbar button {
        padding: 5px 8px;
        font-size: 13px;
        min-width: 32px;
    }
    
    .page-input {
        width: 60px;
        padding: 5px;
        font-size: 13px;
    }
    
    .separator {
        height: 20px;
        margin: 0 3px;
    }
    
    .zoom-level {
        width: 45px;
        font-size: 13px;
    }
    
    .status-info {
        font-size: 12px;
        max-width: 100px;
        order: 1;
        width: 100%;
        text-align: center;
        margin-top: 5px;
    }
    
    .page, .double-page {
        margin: 8px 0;
    }
    
    .thumbnail {
        width: 100px;
        height: 140px;
    }
}

@media (max-width: 480px) {
    .viewer-container {
        width: 320px;
    }
}