/* S3 Gallery Public Styles */

/* Main Gallery Container */
.s3-gallery-container {
    margin: 20px 0;
    max-width: 100%;
}

/* Gallery Header */
.s3-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.s3-gallery-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

.s3-gallery-category {
    background: #0073aa;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Gallery Grid */
.s3-gallery-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

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

.s3-gallery-grid.columns-2 { 
    grid-template-columns: repeat(2, 1fr); 
}

.s3-gallery-grid.columns-3 { 
    grid-template-columns: repeat(3, 1fr); 
}

.s3-gallery-grid.columns-4 { 
    grid-template-columns: repeat(4, 1fr); 
}

.s3-gallery-grid.columns-5 { 
    grid-template-columns: repeat(5, 1fr); 
}

/* Gallery Items */
.s3-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: #fff;
    cursor: pointer;
}

.s3-gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

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

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

/* Image Caption */
.s3-gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 20px 15px 15px;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.s3-gallery-item:hover .s3-gallery-caption {
    opacity: 1;
}

/* Pagination */
.s3-gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.s3-gallery-pagination a {
    padding: 10px 15px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}

.s3-gallery-pagination a:hover {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    transform: translateY(-2px);
}

.s3-gallery-pagination a.current {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    box-shadow: 0 4px 10px rgba(0, 115, 170, 0.3);
}

/* Category Folders View */
.s3-gallery-category-container {
    margin: 30px 0;
}

.s3-gallery-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #0073aa;
}

.s3-gallery-category-header h3 {
    margin: 0;
    color: #0073aa;
    font-size: 1.8em;
    font-weight: 600;
}

.s3-gallery-folder-count {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

/* Folders Grid */
.s3-gallery-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.s3-gallery-folder-item {
    border: 1px solid #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.s3-gallery-folder-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #0073aa;
}

/* Folder Thumbnail */
.s3-gallery-folder-thumbnail {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
}

.s3-gallery-folder-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0, 115, 170, 0.1), rgba(0, 90, 135, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.s3-gallery-folder-item:hover .s3-gallery-folder-thumbnail::after {
    opacity: 1;
}

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

.s3-gallery-folder-item:hover .s3-gallery-folder-thumbnail img {
    transform: scale(1.05);
}

.s3-gallery-folder-placeholder {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-style: italic;
    font-size: 16px;
    position: relative;
}

.s3-gallery-folder-placeholder::before {
    content: '📷';
    font-size: 32px;
    display: block;
    margin-bottom: 10px;
}

/* Folder Info */
.s3-gallery-folder-info {
    padding: 20px;
}

.s3-gallery-folder-info h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
}

.s3-gallery-folder-meta {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #0073aa;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.s3-gallery-folder-description {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.s3-gallery-view-folder {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 115, 170, 0.3);
}

.s3-gallery-view-folder:hover {
    background: linear-gradient(135deg, #005a87, #004670);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 115, 170, 0.4);
}

/* Lightbox Modal (Optional Enhancement) */
.s3-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.s3-gallery-lightbox.active {
    display: flex;
}

.s3-gallery-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.s3-gallery-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.s3-gallery-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* Loading States */
.s3-gallery-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.s3-gallery-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #0073aa;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error States */
.s3-gallery-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .s3-gallery-grid.columns-4,
    .s3-gallery-grid.columns-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .s3-gallery-folders-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .s3-gallery-grid.columns-3,
    .s3-gallery-grid.columns-4,
    .s3-gallery-grid.columns-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .s3-gallery-folders-grid {
        grid-template-columns: 1fr;
    }
    
    .s3-gallery-category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .s3-gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .s3-gallery-item img {
        height: 240px;
    }
    
    .s3-gallery-folder-thumbnail {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .s3-gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .s3-gallery-item img {
        height: 220px;
    }
    
    .s3-gallery-folder-info {
        padding: 15px;
    }
    
    .s3-gallery-pagination {
        gap: 5px;
    }
    
    .s3-gallery-pagination a {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .s3-gallery-folder-placeholder {
        height: 180px;
    }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .s3-gallery-item img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .s3-gallery-pagination,
    .s3-gallery-view-folder {
        display: none;
    }
    
    .s3-gallery-item {
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .s3-gallery-grid {
        display: block;
    }
    
    .s3-gallery-item img {
        height: auto;
        max-height: 300px;
    }
}

/* Accessibility Improvements */
.s3-gallery-item:focus,
.s3-gallery-view-folder:focus,
.s3-gallery-pagination a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .s3-gallery-item,
    .s3-gallery-folder-item,
    .s3-gallery-view-folder,
    .s3-gallery-pagination a,
    .s3-gallery-item img,
    .s3-gallery-folder-thumbnail img {
        transition: none;
    }
}