
.nextcloud-gallery {
    margin: 2rem 0;
}

.gallery-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.gallery-loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gallery-error {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    background: #ffe6e6;
    border-radius: 8px;
}

/* Folder navigation */
.gallery-folders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background: #373737;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 0;
}

.folder-item:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateY(-2px);
}

.folder-icon {
    font-size: 2rem;
}

.folder-info {
    flex: 1;
}

.folder-name {
    font-weight: bold;
    color: #999;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    hyphens: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.folder-count {
    font-size: 0.85rem;
    color: #666;
}

/* Breadcrumb */
.gallery-breadcrumb {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: #373737;
    border-radius: 8px;
}

.breadcrumb-item {
    color: #3498db;
    cursor: pointer;
    transition: color 0.3s ease;
    font-weight: 500;
}

.breadcrumb-item:hover {
    color: #2980b9;
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #999;
    user-select: none;
}

.breadcrumb-current {
    color: #999;
    font-weight: bold;
}

/* Gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: #f5f5f5;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Lightbox styles */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container {
    max-width: 90%;
    max-height: 85%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 2rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
    font-size: 2.5rem;
    line-height: 1;
    padding: 0.3rem 0.8rem;
}

.lightbox-prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-info {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    display: flex;
    gap: 2rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
}

.lightbox-counter {
    font-weight: bold;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }

    .gallery-folders {
        grid-template-columns: 1fr;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 1.5rem;
        padding: 0.3rem 0.6rem;
    }

    .lightbox-info {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.9rem;
    }
}

@media (prefers-color-scheme: light) {

    .folder-item {
        background: #f8f9fa;
    }
    .gallery-breadcrumb {
        background: #f8f9fa;
    }
    .folder-name,
    .breadcrumb-current {
        color: #333;
    }

}
