/**
 * Photo Gallery Styles
 * Professional photo viewer with swipe gestures and metadata display
 */

/* Gallery Container */
.photo-gallery-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15000;
    pointer-events: auto;
}

.photo-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
}

/* Header */
.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.header-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gallery-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.photo-counter {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.gallery-close-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.gallery-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.gallery-close-btn:active {
    transform: scale(0.95);
}

/* Photo Viewer */
.gallery-viewer {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Navigation Buttons */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.gallery-nav:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

.gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-prev {
    left: 2rem;
}

.gallery-next {
    right: 2rem;
}

/* Metadata Panel */
.gallery-metadata {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    max-height: 200px;
    overflow-y: auto;
}

.gallery-metadata.hidden {
    max-height: 0;
    padding: 0 1.5rem;
    opacity: 0;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metadata-item.full-width {
    grid-column: 1 / -1;
}

.metadata-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
}

.metadata-value {
    font-size: 0.875rem;
    color: white;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.metadata-value small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.5rem;
}

/* Thumbnails Strip */
.gallery-thumbnails {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.thumbnail {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.thumbnail:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.thumbnail.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-processing {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Action Buttons */
.gallery-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.gallery-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.gallery-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.gallery-action-btn:active {
    transform: scale(0.95);
}

.gallery-action-btn svg {
    flex-shrink: 0;
}

.download-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.info-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: #8b5cf6;
}

.fullscreen-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

/* Empty State */
.gallery-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.6);
    padding: 2rem;
}

.gallery-empty svg {
    opacity: 0.5;
}

.gallery-empty p {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.gallery-empty small {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .gallery-header {
        padding: 0.75rem 1rem;
    }

    .gallery-title {
        font-size: 1rem;
    }

    .photo-counter {
        font-size: 0.75rem;
    }

    .gallery-nav {
        width: 44px;
        height: 44px;
    }

    .gallery-prev {
        left: 1rem;
    }

    .gallery-next {
        right: 1rem;
    }

    .gallery-metadata {
        max-height: 150px;
    }

    .metadata-grid {
        grid-template-columns: 1fr;
    }

    .gallery-actions {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .gallery-action-btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        justify-content: center;
    }

    .gallery-action-btn span {
        display: none;
    }

    .thumbnail {
        width: 60px;
        height: 60px;
    }
}

/* Fullscreen Mode */
:fullscreen .photo-gallery-overlay,
:-webkit-full-screen .photo-gallery-overlay,
:-moz-full-screen .photo-gallery-overlay {
    background: black;
}

:fullscreen .gallery-header,
:-webkit-full-screen .gallery-header,
:-moz-full-screen .gallery-header {
    background: rgba(0, 0, 0, 0.9);
}

/* Touch Feedback */
@media (hover: none) {
    .gallery-nav:active:not(:disabled) {
        background: rgba(255, 255, 255, 0.3);
    }

    .thumbnail:active {
        opacity: 0.7;
    }
}

/* Animations */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.photo-gallery-overlay.enter {
    animation: fadeIn 0.3s ease;
}

/* Print Styles */
@media print {
    .photo-gallery-container {
        position: relative;
        background: white;
    }

    .gallery-header,
    .gallery-actions,
    .gallery-thumbnails,
    .gallery-nav {
        display: none;
    }

    .gallery-image {
        max-width: 100%;
        max-height: 100%;
        box-shadow: none;
    }

    .gallery-metadata {
        display: block;
        background: transparent;
        color: black;
    }

    .metadata-label,
    .metadata-value {
        color: black;
    }
}
