/**
 * Google Drive Gallery Frontend Styles
 */

/* Gallery Container */
.gdg-gallery-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Gallery Header */
.gdg-gallery-header {
    margin-bottom: 20px;
}

.gdg-back-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.gdg-back-btn:hover {
    background: #005a87;
}

.gdg-back-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

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

.gdg-albums-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.gdg-images-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Album Tiles */
.gdg-album-tile {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.gdg-album-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gdg-album-tile:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.gdg-album-cover {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f8f9fa;
}

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

.gdg-album-tile:hover .gdg-album-cover img {
    transform: scale(1.05);
}

.gdg-album-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 48px;
    color: #666;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.gdg-album-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 20px 15px 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gdg-album-tile:hover .gdg-album-overlay {
    transform: translateY(0);
}

.gdg-album-count {
    font-size: 14px;
    font-weight: 500;
}

.gdg-album-info {
    padding: 15px;
}

.gdg-album-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

/* Image Tiles */
.gdg-image-tile {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.gdg-image-tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gdg-image-tile:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.gdg-image-container {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8f9fa;
}

.gdg-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.gdg-image-tile:hover .gdg-image-container img {
    transform: scale(1.03);
}

.gdg-image-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.gdg-image-name {
    padding: 12px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
    border-top: 1px solid #eee;
}

/* Loading States */
.gdg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.gdg-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: gdg-spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.gdg-no-content,
.gdg-error {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
    grid-column: 1 / -1;
}

.gdg-error {
    color: #d63638;
}

/* Lightbox */
.gdg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

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

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

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

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

.gdg-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 10001;
}

.gdg-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.gdg-lightbox-prev,
.gdg-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.gdg-lightbox-prev {
    left: 20px;
}

.gdg-lightbox-next {
    right: 20px;
}

.gdg-lightbox-prev:hover,
.gdg-lightbox-next:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.gdg-lightbox-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-align: center;
    max-width: 80%;
    z-index: 10001;
}

.gdg-lightbox-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
}

.gdg-lightbox-counter {
    font-size: 14px;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gdg-gallery-container {
        padding: 15px;
    }
    
    .gdg-gallery-grid {
        gap: 15px;
    }
    
    .gdg-albums-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .gdg-images-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .gdg-album-title {
        font-size: 16px;
    }
    
    .gdg-image-name {
        font-size: 13px;
        padding: 10px;
    }
    
    .gdg-lightbox-content {
        padding: 20px;
    }
    
    .gdg-lightbox-prev,
    .gdg-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .gdg-lightbox-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 15px;
        right: 15px;
    }
    
    .gdg-lightbox-info {
        bottom: 15px;
        padding: 8px 16px;
    }
    
    .gdg-lightbox-title {
        font-size: 14px;
    }
    
    .gdg-lightbox-counter {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .gdg-gallery-container {
        padding: 10px;
    }
    
    .gdg-albums-grid {
        grid-template-columns: 1fr;
    }
    
    .gdg-images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .gdg-back-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .gdg-album-info {
        padding: 12px;
    }
    
    .gdg-image-name {
        display: none;
    }
    
    .gdg-lightbox-prev {
        left: 10px;
    }
    
    .gdg-lightbox-next {
        right: 10px;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .gdg-gallery-container {
        color: #f0f0f1;
    }
    
    .gdg-album-tile,
    .gdg-image-tile {
        background: #1d2327;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .gdg-album-tile:hover,
    .gdg-image-tile:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    }
    
    .gdg-album-title {
        color: #f0f0f1;
    }
    
    .gdg-image-name {
        color: #f0f0f1;
        border-top-color: #3c434a;
    }
    
    .gdg-album-placeholder {
        background: linear-gradient(135deg, #2c3338 0%, #3c434a 100%);
        color: #a7aaad;
    }
    
    .gdg-album-cover,
    .gdg-image-container {
        background: #2c3338;
    }
    
    .gdg-back-btn {
        background: #135e96;
    }
    
    .gdg-back-btn:hover {
        background: #1e6ba8;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .gdg-album-tile,
    .gdg-image-tile {
        border: 2px solid #000;
    }
    
    .gdg-album-tile:hover,
    .gdg-image-tile:hover {
        border-color: #0073aa;
    }
    
    .gdg-back-btn {
        border: 2px solid #000;
    }
    
    .gdg-lightbox-close,
    .gdg-lightbox-prev,
    .gdg-lightbox-next {
        border: 2px solid #fff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gdg-album-tile,
    .gdg-image-tile,
    .gdg-album-cover img,
    .gdg-image-container img,
    .gdg-album-overlay,
    .gdg-lightbox-prev,
    .gdg-lightbox-next,
    .gdg-back-btn {
        transition: none;
    }
    
    .gdg-spinner {
        animation: none;
    }
    
    .gdg-album-tile:hover,
    .gdg-image-tile:hover {
        transform: none;
    }
    
    .gdg-album-tile:hover .gdg-album-cover img,
    .gdg-image-tile:hover .gdg-image-container img {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .gdg-gallery-header,
    .gdg-lightbox {
        display: none !important;
    }
    
    .gdg-gallery-grid {
        display: block;
    }
    
    .gdg-album-tile,
    .gdg-image-tile {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .gdg-album-cover,
    .gdg-image-container {
        background: #fff !important;
    }
}

/* Focus Visible Support */
@supports selector(:focus-visible) {
    .gdg-album-tile:focus:not(:focus-visible),
    .gdg-image-tile:focus:not(:focus-visible),
    .gdg-back-btn:focus:not(:focus-visible) {
        outline: none;
    }
    
    .gdg-album-tile:focus-visible,
    .gdg-image-tile:focus-visible,
    .gdg-back-btn:focus-visible {
        outline: 2px solid #0073aa;
        outline-offset: 2px;
    }
}