/**
 * Estilos del Módulo de Biblioteca
 * Galería de imágenes con diseño OpenAI
 */

/* ============================================== 
   LAYOUT PRINCIPAL
   ============================================== */

.biblioteca-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    padding: 20px;
    gap: 20px;
}

/* ============================================== 
   TOOLBAR SUPERIOR
   ============================================== */

.biblioteca-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.biblioteca-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.biblioteca-toolbar-left h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.biblioteca-stats {
    font-size: 14px;
    color: #6b7280;
}

.biblioteca-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================== 
   GALERÍA DE IMÁGENES
   ============================================== */

.biblioteca-content {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.biblioteca-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* ============================================== 
   ITEMS DE IMAGEN
   ============================================== */

.biblioteca-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.biblioteca-item:hover {
    border-color: #9ca3af;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.biblioteca-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.biblioteca-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.biblioteca-item:hover .biblioteca-item-overlay {
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
}

.biblioteca-item-actions {
    display: flex;
    gap: 8px;
}

.biblioteca-item-action {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.biblioteca-item-action:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.biblioteca-item-action svg {
    width: 20px;
    height: 20px;
    color: #111827;
}

.biblioteca-item-action.delete svg {
    color: #ef4444;
}

/* ============================================== 
   ESTADO VACÍO
   ============================================== */

.biblioteca-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    grid-column: 1 / -1;
    padding: 40px 0 !important;
}

.biblioteca-empty svg {
    width: 64px;
    height: 64px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.biblioteca-empty h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.biblioteca-empty p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

/* ============================================== 
   LOADING STATE
   ============================================== */

.biblioteca-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 14px;
}

/* ============================================== 
   MODAL DE IMAGEN
   ============================================== */

.biblioteca-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.biblioteca-modal.active {
    display: flex;
}

.biblioteca-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.biblioteca-modal-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.biblioteca-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.biblioteca-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.biblioteca-modal-close svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.biblioteca-modal-info {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    text-align: center;
    color: #ffffff;
    font-size: 14px;
}

/* ============================================== 
   ZONA DE ARRASTRE (OPCIONAL)
   ============================================== */

.biblioteca-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.biblioteca-drop-zone:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.biblioteca-drop-zone.dragging {
    border-color: #3b82f6;
    background: #eff6ff;
}

.biblioteca-drop-zone svg {
    width: 48px;
    height: 48px;
    color: #9ca3af;
    margin-bottom: 12px;
}

.biblioteca-drop-zone h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.biblioteca-drop-zone p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

/* ============================================== 
   PAGINACIÓN
   ============================================== */

.pagination-controls {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    margin-top: 20px;
}

.pagination-controls button {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-controls span {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* ============================================== 
   SCROLLBAR
   ============================================== */

.biblioteca-content::-webkit-scrollbar {
    width: 8px;
}

.biblioteca-content::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.biblioteca-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.biblioteca-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================== 
   RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
    .biblioteca-container {
        padding: 12px;
    }

    .biblioteca-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .biblioteca-toolbar-left,
    .biblioteca-toolbar-right {
        width: 100%;
    }

    .biblioteca-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .biblioteca-modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
}

