/* Enhanced Photo Modal with Zoom Functionality */

.photo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.photo-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    flex-direction: column;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 10001;
}

/* Modal Header */
.modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 10002;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-counter {
    color: white;
    font-size: 16px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.modal-controls {
    display: flex;
    gap: 10px;
}

.modal-controls button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.modal-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.zoom-in-btn:hover {
    background: rgba(46, 204, 113, 0.3);
}

.zoom-out-btn:hover {
    background: rgba(231, 76, 60, 0.3);
}

.zoom-reset-btn:hover {
    background: rgba(52, 152, 219, 0.3);
}

.fullscreen-btn:hover {
    background: rgba(155, 89, 182, 0.3);
}

/* Modal Navigation */
.modal-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10002;
    pointer-events: none;
}

.modal-prev,
.modal-next {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.modal-prev:hover,
.modal-next:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Modal Content */
.modal-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    overflow: hidden;
}

.image-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
}

.image-container:active {
    cursor: grabbing;
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Modal Footer */
.modal-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10002;
}

.modal-info h3 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.download-btn,
.share-btn {
    background: rgba(52, 152, 219, 0.8);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.download-btn:hover {
    background: rgba(52, 152, 219, 1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.share-btn {
    background: rgba(46, 204, 113, 0.8);
}

.share-btn:hover {
    background: rgba(46, 204, 113, 1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

/* Notification */
.modal-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(46, 204, 113, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10003;
    animation: notificationSlideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Gallery Enhancements */
.gallery-item {
    transition: all 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.gallery-image {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.gallery-photo {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-photo {
    transform: scale(1.05);
}

.gallery-overlay {
    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;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 20px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.gallery-item:hover .overlay-content {
    transform: translateY(0);
}

.overlay-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.overlay-content p {
    margin: 0 0 15px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.view-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.view-btn:hover {
    background: linear-gradient(45deg, #2980b9, #1f4e79);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.view-btn i {
    font-size: 0.8rem;
}

/* Fullscreen mode */
.photo-modal:-webkit-full-screen {
    background: #000;
}

.photo-modal:-moz-full-screen {
    background: #000;
}

.photo-modal:fullscreen {
    background: #000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-header {
        height: 50px;
        padding: 0 15px;
    }
    
    .modal-close,
    .modal-controls button {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .modal-counter {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .modal-navigation {
        padding: 0 15px;
    }
    
    .modal-prev,
    .modal-next {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .modal-content {
        padding: 60px 15px;
    }
    
    .modal-footer {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
    }
    
    .modal-info h3 {
        font-size: 16px;
        text-align: center;
    }
    
    .modal-actions {
        justify-content: center;
    }
    
    .download-btn,
    .share-btn {
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .gallery-photo {
        height: 200px;
    }
    
    .overlay-content {
        padding: 15px;
    }
    
    .overlay-content h3 {
        font-size: 1rem;
    }
    
    .view-btn {
        padding: 10px 20px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .modal-header {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 10px;
    }
    
    .modal-content {
        padding: 100px 10px 80px;
    }
    
    .modal-navigation {
        padding: 0 10px;
    }
    
    #modal-image {
        border-radius: 4px;
    }
}

/* Animations */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.photo-modal.active .modal-container {
    animation: modalSlideIn 0.3s ease-out;
}

/* Loading States */
.gallery-item.loading .gallery-photo {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #modal-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Focus indicators for accessibility */
.modal-close:focus,
.modal-controls button:focus,
.modal-prev:focus,
.modal-next:focus,
.download-btn:focus,
.share-btn:focus,
.view-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Smooth scrolling for page */
html {
    scroll-behavior: smooth;
}

/* Theme integration */
:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --text-color: #333;
    --text-light: #666;
    --background-color: #ffffff;
    --background-light: #f8f9fa;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #ffffff;
        --text-light: #cccccc;
        --background-color: #1a1a1a;
        --background-light: #2c2c2c;
        --border-color: #444444;
        --shadow-color: rgba(255, 255, 255, 0.1);
    }
}
