/* Photo Gallery Specific Styles */

/* Gallery Controls */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.gallery-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #f8f9fa;
}

.tab-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Gallery Grid */
.gallery-container {
    min-height: 400px;
}

.photo-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Portrait Grid - Optimized for taller images */
.photo-grid.portrait {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Landscape Grid - Optimized for wider images */
.photo-grid.landscape {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

/* All Photos Grid - Mixed layout */
.photo-grid.all {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Photo Items */
.photo-item {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.photo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    /* Basic copy protection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

/* Portrait photos - taller aspect ratio */
.photo-item.portrait img {
    height: 300px;
}

/* Landscape photos - standard aspect ratio */
.photo-item.landscape img {
    height: 200px;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10;
}

.photo-info {
    padding: 1rem;
}

.photo-info h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.photo-info p {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1002;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    z-index: 1002;
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.modal-prev {
    left: -60px;
}

.modal-next {
    right: -60px;
}

.modal img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
    /* Copy protection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

.modal-info {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    text-align: center;
    max-width: 500px;
}

.modal-info h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.modal-info p {
    margin: 0;
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-tabs {
        justify-content: center;
    }

    .photo-grid.portrait,
    .photo-grid.landscape,
    .photo-grid.all {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .photo-item img {
        height: 150px;
    }

    .photo-item.portrait img {
        height: 200px;
    }

    .modal-nav {
        display: none; /* Hide navigation arrows on mobile, use touch */
    }

    .modal-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .photo-grid.portrait,
    .photo-grid.landscape,
    .photo-grid.all {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .photo-item {
        border-radius: 4px;
    }

    .photo-info {
        padding: 0.5rem;
    }

    .photo-info h3 {
        font-size: 0.875rem;
    }

    .photo-info p {
        font-size: 0.75rem;
    }
}

/* Loading and Error States */
.gallery-loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.gallery-error {
    text-align: center;
    padding: 3rem;
}

.gallery-empty {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.gallery-empty h3 {
    margin-bottom: 1rem;
    color: #6c757d;
}

/* Image Error Handling */
.photo-item.image-error {
    border: 2px solid #dc3545;
    opacity: 0.7;
}

.image-retry {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: background-color 0.2s ease;
}

.image-retry:hover {
    background: rgba(220, 53, 69, 1);
}

.modal-error {
    background: #f8d7da;
    color: #721c24;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    font-size: 0.875rem;
    border: 1px solid #f5c6cb;
}

/* Disable context menu and selection for copy protection */
.photo-item,
.modal img {
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -o-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.photo-item img,
.modal img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}