/* Designtoe Gallery Frontend Styles */
.designtoe-gallery {
    margin: 20px 0;
    position: relative;
}

.gallery-description {
    margin-bottom: 20px;
    text-align: center;
}

.gallery-description p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* Enhanced Mosaic Layout */
.gallery-mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    grid-auto-rows: 150px;
    gap: var(--spacing, 8px);
    grid-auto-flow: dense;
    padding: 10px;
}

/* Grid Layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--column-count, 4), 1fr);
    gap: var(--spacing, 8px);
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius, 12px);
    background: #f9fafb;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

/* Enhanced Mosaic Sizing - More Varied Layout */
.gallery-mosaic .gallery-item {
    grid-row: span 2;
    grid-column: span 1;
}

/* Large featured items */
.gallery-mosaic .gallery-item:nth-child(1),
.gallery-mosaic .gallery-item:nth-child(8),
.gallery-mosaic .gallery-item:nth-child(15) {
    grid-column: span 2;
    grid-row: span 3;
}

/* Wide landscape items */
.gallery-mosaic .gallery-item:nth-child(3),
.gallery-mosaic .gallery-item:nth-child(7),
.gallery-mosaic .gallery-item:nth-child(12),
.gallery-mosaic .gallery-item:nth-child(18) {
    grid-column: span 2;
    grid-row: span 2;
}

/* Tall portrait items */
.gallery-mosaic .gallery-item:nth-child(5),
.gallery-mosaic .gallery-item:nth-child(11),
.gallery-mosaic .gallery-item:nth-child(16),
.gallery-mosaic .gallery-item:nth-child(21) {
    grid-column: span 1;
    grid-row: span 3;
}

/* Medium items */
.gallery-mosaic .gallery-item:nth-child(4),
.gallery-mosaic .gallery-item:nth-child(9),
.gallery-mosaic .gallery-item:nth-child(14),
.gallery-mosaic .gallery-item:nth-child(19) {
    grid-column: span 1;
    grid-row: span 2;
}

/* Extra wide panoramic items */
.gallery-mosaic .gallery-item:nth-child(6),
.gallery-mosaic .gallery-item:nth-child(13),
.gallery-mosaic .gallery-item:nth-child(20) {
    grid-column: span 3;
    grid-row: span 2;
}

/* Small square items */
.gallery-mosaic .gallery-item:nth-child(10),
.gallery-mosaic .gallery-item:nth-child(17),
.gallery-mosaic .gallery-item:nth-child(22) {
    grid-column: span 1;
    grid-row: span 1;
}

.gallery-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius, 12px);
    width: 100%;
    height: 100%;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

/* Enhanced Hover Zoom Effect */
.gallery-item:hover .gallery-image {
    transform: scale(1.08);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    border-radius: var(--border-radius, 12px);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-zoom-icon {
    font-size: 32px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,255,255,0.3);
}

.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;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

.gallery-caption p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Enhanced Lightbox Styles */
.designtoe-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    background: rgba(0,0,0,0.95);
}

.designtoe-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px;
    box-sizing: border-box;
}

.lightbox-image-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: zoomIn 0.4s ease;
}

.lightbox-caption {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    white-space: nowrap;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    backdrop-filter: blur(10px);
}

/* Enhanced Navigation Buttons */
.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-weight: 300;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 24px;
    padding: 20px 25px;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    font-weight: bold;
    min-width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

/* Gallery Credit */
.gallery-credit {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 15px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

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

.gallery-credit a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.gallery-credit a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .gallery-mosaic {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        grid-auto-rows: 140px;
    }
    
    .gallery-mosaic .gallery-item:nth-child(6),
    .gallery-mosaic .gallery-item:nth-child(13),
    .gallery-mosaic .gallery-item:nth-child(20) {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .gallery-mosaic {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        grid-auto-rows: 120px;
        gap: 6px;
        padding: 5px;
    }
    
    .gallery-mosaic .gallery-item:nth-child(1),
    .gallery-mosaic .gallery-item:nth-child(8),
    .gallery-mosaic .gallery-item:nth-child(15) {
        grid-column: span 2;
        grid-row: span 2;
    }
    
    .gallery-mosaic .gallery-item:nth-child(6),
    .gallery-mosaic .gallery-item:nth-child(13),
    .gallery-mosaic .gallery-item:nth-child(20) {
        grid-column: span 2;
        grid-row: span 1;
    }
    
    .gallery-caption {
        padding: 15px 10px 10px;
    }
    
    .gallery-caption p {
        font-size: 12px;
    }
    
    .lightbox-content {
        padding: 80px 10px 10px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        padding: 15px 20px;
        font-size: 20px;
        min-width: 50px;
        height: 50px;
    }
    
    .lightbox-prev {
        left: 15px;
    }
    
    .lightbox-next {
        right: 15px;
    }
    
    .lightbox-close {
        top: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .lightbox-caption {
        bottom: -50px;
        font-size: 14px;
        padding: 10px 20px;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .gallery-mosaic {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 100px;
    }
    
    .gallery-mosaic .gallery-item {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    .gallery-mosaic .gallery-item:nth-child(odd) {
        grid-row: span 2;
    }
    
    .designtoe-gallery {
        margin: 15px 0;
    }
    
    .gallery-description p {
        font-size: 14px;
    }
    
    .gallery-zoom-icon {
        font-size: 24px;
        width: 50px;
        height: 50px;
    }
}

/* Loading Animation */
.gallery-loading {
    text-align: center;
    padding: 60px;
    color: #6b7280;
}

.gallery-loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #3b82f6;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 15px;
}

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

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Print Styles */
@media print {
    .gallery-overlay,
    .lightbox-prev,
    .lightbox-next,
    .lightbox-close {
        display: none !important;
    }
    
    .gallery-mosaic,
    .gallery-grid {
        break-inside: avoid;
    }
    
    .gallery-item {
        break-inside: avoid;
        margin-bottom: 15px;
    }
}

/* Accessibility */
.gallery-item:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .gallery-overlay {
        background: rgba(0,0,0,0.9);
    }
    
    .gallery-caption {
        background: linear-gradient(transparent, rgba(0,0,0,0.95));
    }
    
    .gallery-credit {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-image,
    .gallery-overlay,
    .gallery-caption,
    .lightbox-overlay,
    .lightbox-image {
        transition: none;
        animation: none;
    }
    
    .gallery-item:hover .gallery-image {
        transform: none;
    }
}

/* Custom scrollbar for lightbox */
.lightbox-content::-webkit-scrollbar {
    width: 8px;
}

.lightbox-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.lightbox-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.lightbox-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}