/**
 * Google Drive Gallery - Frontend Styles
 */

/* Main Gallery Container */
.gdrive-gallery-container {
    width: 100%;
    position: relative;
}

/* Loading State */
.gdrive-gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.gdrive-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: gdrive-spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes gdrive-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gdrive-gallery-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Grid Layout */
.gdrive-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
}

/* Tablet Layout */
@media (max-width: 768px) {
    .gdrive-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Mobile Layout */
@media (max-width: 480px) {
    .gdrive-gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Gallery Items */
.gdrive-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.gdrive-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: all 0.3s ease;
    border-radius: inherit;
}

/* Hover Effects */
.gdrive-gallery-grid.hover-none .gdrive-gallery-item:hover {
    transform: none;
}

.gdrive-gallery-grid.hover-zoom .gdrive-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.gdrive-gallery-grid.hover-zoom .gdrive-gallery-item:hover img {
    transform: scale(1.05);
}

.gdrive-gallery-grid.hover-fade .gdrive-gallery-item {
    position: relative;
}

.gdrive-gallery-grid.hover-fade .gdrive-gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    transition: all 0.3s ease;
    border-radius: inherit;
    z-index: 1;
}

.gdrive-gallery-grid.hover-fade .gdrive-gallery-item:hover::before {
    background: rgba(0,0,0,0.2);
}

.gdrive-gallery-grid.hover-slide .gdrive-gallery-item {
    position: relative;
}

.gdrive-gallery-grid.hover-slide .gdrive-gallery-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    transition: all 0.3s ease;
    border-radius: 0 0 inherit inherit;
}

.gdrive-gallery-grid.hover-slide .gdrive-gallery-item:hover::after {
    height: 50%;
}

.gdrive-gallery-grid.hover-slide .gdrive-gallery-item:hover {
    transform: translateY(-3px);
}

/* Error State */
.gdrive-gallery-error {
    padding: 30px 20px;
    text-align: center;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c33;
    margin: 20px 0;
}

.gdrive-gallery-error p {
    margin: 0 0 10px;
    font-weight: 500;
}

.gdrive-gallery-error a {
    color: #c33;
    text-decoration: underline;
}

/* Lightbox Overlay */
.gdrive-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gdrive-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Content */
.gdrive-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.gdrive-lightbox-overlay.active .gdrive-lightbox-content {
    transform: scale(1);
}

.gdrive-lightbox-image {
    max-width: 100%;
    max-height: 100vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease;
    background: rgba(255,255,255,0.1);
    min-height: 100px;
    min-width: 100px;
}

/* Lightbox Controls */
.gdrive-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.gdrive-lightbox-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.gdrive-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.gdrive-lightbox-nav:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.gdrive-lightbox-prev {
    left: -70px;
}

.gdrive-lightbox-next {
    right: -70px;
}

/* Lightbox Counter */
.gdrive-lightbox-counter {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Mobile Lightbox Adjustments */
@media (max-width: 768px) {
    .gdrive-lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .gdrive-lightbox-close {
        top: -40px;
        right: -10px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .gdrive-lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .gdrive-lightbox-prev {
        left: -55px;
    }
    
    .gdrive-lightbox-next {
        right: -55px;
    }
    
    .gdrive-lightbox-counter {
        bottom: -40px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .gdrive-lightbox-prev {
        left: 10px;
        top: 10px;
        transform: none;
    }
    
    .gdrive-lightbox-next {
        right: 10px;
        top: 10px;
        transform: none;
    }
    
    .gdrive-lightbox-close {
        top: 10px;
        right: 50%;
        left: auto;
        transform: translateX(50%);
    }
    
    .gdrive-lightbox-counter {
        bottom: 10px;
    }
}

/* Loading Animation for Images */
.gdrive-gallery-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: gdrive-loading 1.5s infinite;
}

@keyframes gdrive-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Accessibility */
.gdrive-gallery-item:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.gdrive-lightbox-close:focus,
.gdrive-lightbox-nav:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .gdrive-lightbox-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .gdrive-lightbox-close,
    .gdrive-lightbox-nav {
        background: rgba(255,255,255,0.9);
        color: black;
    }
    
    .gdrive-lightbox-counter {
        background: rgba(255,255,255,0.9);
        color: black;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .gdrive-gallery-item,
    .gdrive-gallery-item img,
    .gdrive-lightbox-overlay,
    .gdrive-lightbox-content,
    .gdrive-lightbox-close,
    .gdrive-lightbox-nav {
        transition: none;
    }
    
    .gdrive-spinner {
        animation: none;
        border-top-color: transparent;
    }
}