/* Media Upload Styles */

.media-upload-container {
    margin-top: 20px;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-area.dragover {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.02);
}

.upload-content i {
    font-size: 48px;
    color: #6b7280;
    margin-bottom: 16px;
}

.upload-content h4 {
    margin: 0 0 8px 0;
    color: #374151;
    font-size: 18px;
    font-weight: 600;
}

.upload-content p {
    margin: 4px 0;
    color: #6b7280;
    font-size: 14px;
}

.media-preview-container {
    margin-top: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.media-preview-container h4 {
    margin: 0 0 16px 0;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.media-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;
}

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

.media-item img,
.media-item video {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.media-item.video-item::before {
    content: '\f04b';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.6);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.media-item-info {
    padding: 8px 12px;
    background: white;
}

.media-item-name {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.media-item-size {
    font-size: 11px;
    color: #6b7280;
}

.media-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.2s ease;
}

.media-item-remove:hover {
    background: rgba(220, 38, 38, 1);
}

.upload-progress {
    margin-top: 20px;
    padding: 16px;
    background: #f3f4f6;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}

/* Media Gallery Display (for mosque detail page) */
.media-gallery {
    margin: 24px 0;
}

.media-gallery h3 {
    margin: 0 0 16px 0;
    color: #374151;
    font-size: 20px;
    font-weight: 600;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

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

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

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.gallery-item.video-item::before {
    content: '\f04b';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 32px;
    background: rgba(0, 0, 0, 0.6);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.gallery-item-caption {
    padding: 12px;
    background: white;
}

.gallery-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

/* View Gallery Button Styles */
.view-gallery-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.view-gallery-btn:hover {
    background: linear-gradient(135deg, #047857, #059669);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.view-gallery-btn:active {
    transform: translateY(0);
}

.view-gallery-btn i {
    font-size: 1.2rem;
}

/* Modal for full-size media viewing */
.media-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.media-modal.active {
    display: flex;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.modal-content img,
.modal-content video {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-nav.prev {
    left: 20px;
}

.modal-nav.next {
    right: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-content i {
        font-size: 36px;
    }
    
    .upload-content h4 {
        font-size: 16px;
    }
    
    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 100px), 1fr));
        gap: 8px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .media-item img,
    .media-item video {
        height: 80px;
    }
    
    .gallery-item img,
    .gallery-item video {
        height: 200px;
    }
    
    .view-gallery-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .view-gallery-btn i {
        font-size: 1.1rem;
    }
}

@media (max-width: 380px) {
    .upload-area {
        padding: 1.25rem 0.75rem;
    }

    .media-preview-container {
        padding: 0.75rem;
    }

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