/* Gallery Page Styling with Construction Theme */

/* Page Load Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal animation */
@keyframes animatetop {
    from {
        top: -100px;
        opacity: 0;
    }
    to {
        top: 50px;
        opacity: 1;
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

body {
    animation: fadeIn 0.5s ease-in;
    margin: 0;
    padding: 0;
    padding-top: 70px; /* Space for fixed header */
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px; /* Space for footer */
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
}

/* Hide gallery button when on gallery page */
#galleryBtn {
    display: none !important;
}

/* Modal styles to match index page */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    overflow-y: auto; /* Allow scrolling the modal backdrop */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Modal content - Construction themed dark background */
.modal-content {
    padding: 30px;
    border-radius: 12px;
    width: 80%;
    max-width: 700px;
    position: absolute; /* Changed from fixed to work better with modal scrolling */
    top: 50px; /* Start position for animation */
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 50px; /* Space at bottom for scrolling */
    opacity: 0;
    animation-name: animatetop;
    animation-duration: 1s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-out;
    border: 3px solid #FF6B00;
    background: linear-gradient(135deg, 
                rgba(44, 62, 80, 0.98) 0%, 
                rgba(52, 73, 94, 0.98) 100%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 107, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow-y: visible; /* Remove scrollbar from modal content - let modal handle it */
    max-height: none; /* Remove height restriction */
    color: #ffffff;
}

/* Mobile and tablet modal adjustments */
@media only screen and (max-width: 768px) {
    .modal {
        align-items: flex-start; /* Align to top instead of center */
        padding: 10px 0;
    }
    
    .modal-content {
        width: 95%;
        max-height: none; /* Remove max-height constraint */
        overflow-y: visible; /* Modal itself doesn't scroll, parent does */
        top: 20px; /* Small top margin */
        padding: 20px; /* Comfortable padding */
        position: relative; /* Let it flow naturally in the scrolling container */
        margin: 20px auto 50px; /* Center horizontally with top/bottom margins */
        animation: modalFadeIn 0.5s ease-out forwards; /* Simpler animation for mobile */
    }
    
    /* Remove overflow from forms - let modal container handle scrolling */
    #projectContactForm,
    #loginForm,
    #accountRecoveryForm {
        max-height: none; /* Remove height restriction */
        overflow-y: visible; /* Remove scrollbar from forms */
    }
}

/* Mobile/Tablet landscape adjustments - prevent modal overflow */
@media only screen and (orientation: landscape) and (max-width: 1024px) and (max-height: 600px) {
    /* For shorter landscape screens (phones) */
    .modal-content {
        max-height: none !important;
        overflow-y: visible !important;
        top: 2vh !important;
        padding: 8px !important;
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin-bottom: 2vh !important;
    }
    
    #projectContactForm,
    #loginForm,
    #accountRecoveryForm {
        max-height: none !important;
        overflow-y: visible !important;
        padding: 5px !important;
    }
    
    /* Ensure form inputs are compact in landscape */
    .modal-content input[type="text"],
    .modal-content input[type="email"],
    .modal-content textarea {
        padding: 6px !important;
        font-size: 14px !important;
    }
    
    .modal-content label {
        font-size: 13px !important;
        margin-bottom: 3px !important;
    }
}

/* Tablet landscape adjustments (taller screens like iPad) */
@media only screen and (orientation: landscape) and (min-width: 600px) and (max-width: 1024px) and (min-height: 600px) {
    .modal-content {
        width: 85% !important;
        max-height: none !important;
        overflow-y: visible !important;
        top: 5vh !important;
        padding: 15px 20px !important;
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin-bottom: 5vh !important;
        box-sizing: border-box !important;
    }
    
    #projectContactForm,
    #loginForm,
    #accountRecoveryForm {
        max-height: none !important;
        overflow-y: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Compact form elements for tablets */
    .modal-content input,
    .modal-content textarea,
    .modal-content select {
        margin-bottom: 8px !important;
        padding: 8px !important;
    }
    
    .modal-content label {
        margin-bottom: 4px !important;
        margin-top: 8px !important;
    }
    
    .modal-content button {
        margin-top: 10px !important;
    }
}

/* Modal Content Typography & Form Elements - Construction Theme */
.modal-content h2 {
    color: #FFA500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.modal-content p,
.modal-content label {
    color: #ffffff;
}

.modal-content label {
    font-weight: bold;
    color: #FFA500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.modal-content input,
.modal-content textarea,
.modal-content select,
.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="email"],
.modal-content input[type="file"] {
    background-color: rgba(100, 130, 150, 0.5) !important;
    color: #ffffff !important;
    border: 3px solid #FF6B00 !important;
    border-radius: 6px;
    padding: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.2);
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus,
.modal-content input[type="text"]:focus,
.modal-content input[type="password"]:focus,
.modal-content input[type="email"]:focus {
    outline: none;
    border-color: #FFA500 !important;
    border-width: 4px !important;
    background-color: rgba(120, 150, 170, 0.6) !important;
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.5);
}

.modal-content input::placeholder,
.modal-content textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Ensure file inputs have proper styling */
.modal-content input[type="file"] {
    /* Keep file input hidden offscreen; label is the visible trigger */
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    border: 0 !important;
}

/* Bot Protection Styles - Hide honeypot fields */
.honeypot-fields {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    z-index: -1 !important;
    opacity: 0 !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Mobile responsive form fields */
@media only screen and (max-width: 768px) {
    /* Prevent any horizontal scroll on phones */
    html, body { overflow-x: hidden; }
    .modal { overflow-x: hidden; }

    /* Fit modal content to viewport width */
    .modal-content {
        width: 95% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        box-sizing: border-box !important;
    }
    .modal-content input,
    .modal-content textarea,
    .modal-content select,
    .modal-content input[type="text"],
    .modal-content input[type="password"],
    .modal-content input[type="email"],
    .modal-content input[type="file"] {
        border: 3px solid #FF6B00 !important;
        background-color: rgba(100, 130, 150, 0.5) !important;
        color: #ffffff !important;
        box-shadow: 0 0 10px rgba(255, 107, 0, 0.2);
    }
}

.modal-content button {
    background: linear-gradient(135deg, #FF6B00 0%, #FFA500 100%);
    color: #fff;
    border: 2px solid #fff;
    font-weight: bold;
    border-radius: 8px;
    padding: 12px 25px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 10px rgba(255, 107, 0, 0.3);
    transition: all 0.3s ease;
}

.modal-content button:hover {
    background: linear-gradient(135deg, #e65c00 0%, #ff9500 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 0, 0.5);
    border-color: #FFD700;
}

.modal-content a {
    color: #FFA500;
    font-weight: bold;
}

.modal-content a:hover {
    color: #FFD700;
}

/* ============================================================================
   GALLERY PAGE - Construction-Themed Professional Design (Matches Index)
   ============================================================================ */

.gallery-section {
    padding: 130px 30px 100px;
    min-height: calc(100vh - 200px);
    background: linear-gradient(135deg, 
                rgba(44, 62, 80, 0.98) 0%, 
                rgba(52, 73, 94, 0.98) 100%);
    margin: 25px;
    margin-top: 80px;
    border-radius: 15px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 107, 0, 0.5);
    animation: fadeIn 0.8s ease-in;
    position: relative;
}

/* Construction-themed decorative elements - Hidden on mobile to prevent overlap */
.gallery-section::before {
    content: "🏗️";
    position: absolute;
    top: 30px;
    left: 40px;
    font-size: 50px;
    opacity: 0.2;
    animation: float 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

.gallery-section::after {
    content: "🔨";
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 50px;
    opacity: 0.2;
    animation: float 3s ease-in-out infinite 1.5s;
    pointer-events: none;
    z-index: 1;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Hide decorative emojis on mobile to prevent overlap */
@media only screen and (max-width: 768px) {
    .gallery-section::before,
    .gallery-section::after {
        display: none;
    }
}

.gallery-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 30px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 12px;
    border: 3px solid #FF6B00;
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.3);
    position: relative;
    z-index: 10;
}

.gallery-header h1 {
    color: #FFA500;
    font-size: 52px;
    font-weight: bold;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 165, 0, 0.3);
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.gallery-header p {
    color: #fff;
    font-size: 20px;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive header adjustments */
@media only screen and (max-width: 768px) {
    .gallery-header {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .gallery-header h1 {
        font-size: 36px;
        letter-spacing: 1px;
    }
    
    .gallery-header p {
        font-size: 16px;
    }
}

/* Simple Gallery Navigation (No emojis) */
.gallery-nav-box-simple {
    text-align: center;
    margin: 30px auto;
    padding: 0;
    max-width: 400px;
}

.gallery-nav-link-simple {
    display: inline-block;
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    padding: 12px 30px;
    background: linear-gradient(135deg, #FF6B00 0%, #FFA500 100%);
    border: 3px solid #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
    transition: all 0.3s ease;
}

.gallery-nav-link-simple:hover {
    background: linear-gradient(135deg, #e65c00 0%, #ff9500 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.6);
    border-color: #FFD700;
}

.gallery-nav-link-simple:active {
    transform: translateY(0);
}

/* Thumbnail Gallery Grid - Construction themed */
.thumbnail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 35px;
    padding: 30px;
    padding-bottom: 50px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .gallery-section {
        padding: 100px 20px 80px;
        margin: 15px;
    }
    
    .thumbnail-gallery {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .gallery-section {
        padding: 90px 15px 70px;
        margin: 10px;
    }
    
    .thumbnail-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }
    
    .gallery-section::before,
    .gallery-section::after {
        font-size: 40px;
        top: 10px;
        left: 10px;
    }
}

/* Thumbnail Card - Construction-Themed Professional */
.thumbnail-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 107, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
    border: 4px solid #FFA500;
    transform-origin: center;
}

.thumbnail-card::before {
    content: "🔨";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 30px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.thumbnail-card:hover::before {
    opacity: 0.7;
}

.thumbnail-card:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 
        0 15px 40px rgba(255, 107, 0, 0.4),
        0 0 0 5px rgba(255, 165, 0, 0.2),
        0 0 30px rgba(255, 107, 0, 0.3);
    border-color: #FF6B00;
    border-width: 5px;
}

.thumbnail-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    transition: all 0.4s ease;
    filter: brightness(1) contrast(1.05);
}

.thumbnail-card:hover .thumbnail-image {
    transform: scale(1.08);
    filter: brightness(1.1) contrast(1.1);
}

/* Thumbnail Overlay - Construction themed */
.thumbnail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, 
                rgba(44, 62, 80, 0.98) 0%, 
                rgba(52, 73, 94, 0.95) 70%,
                transparent 100%);
    padding: 25px;
    transform: translateY(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 100%;
    overflow-y: auto;
    border-top: 3px solid rgba(255, 107, 0, 0.8);
    z-index: 3;
}

.thumbnail-card:hover .thumbnail-overlay {
    transform: translateY(0);
}

.thumbnail-card.active .thumbnail-overlay {
    transform: translateY(0);
}

/* MOBILE: Always show overlay on small screens and touch devices */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .thumbnail-overlay {
        transform: translateY(0) !important; /* Always show full overlay */
        pointer-events: auto; /* Ensure buttons are clickable */
        position: absolute;
        z-index: 5;
    }
    
    .thumbnail-card:active .thumbnail-overlay,
    .thumbnail-card.active .thumbnail-overlay {
        transform: translateY(0) !important;
        opacity: 1;
    }
}

/* Thumbnail info styling - Construction themed */
.thumbnail-info h3 {
    color: #FFA500;
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.thumbnail-info p {
    color: #fff;
    font-size: 16px;
    margin: 0;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
}

/* Add construction icon to gallery items */
.thumbnail-info::before {
    content: "📐";
    font-size: 20px;
    margin-right: 8px;
}

/* Full Gallery Modal */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: hidden; /* Prevent background scroll */
    touch-action: none; /* Disable touch scrolling on the modal background */
}

.gallery-modal-content {
    position: relative;
    margin: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto; /* Allow scrolling within the modal content only */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    touch-action: pan-y; /* Allow vertical scrolling only within modal content */
}

.gallery-title {
    color: #FFA500;
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.close-gallery {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #FFA500;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 2005; /* Higher z-index to stay above all content */
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
    padding: 5px 15px;
    border-radius: 8px;
    line-height: 1;
}

.close-gallery:hover,
.close-gallery:focus {
    color: #FF6B00;
    text-decoration: none;
    background-color: rgba(0, 0, 0, 0.9);
}

/* Hide edit/manage buttons inside the gallery modal viewer */
.gallery-modal .delete-image-btn,
.gallery-modal .set-cover-btn,
.gallery-modal-content .delete-image-btn,
.gallery-modal-content .set-cover-btn {
    display: none !important;
}

/* Gallery Viewer */
.gallery-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 1;
    width: 100%;
    padding: 20px;
}

.gallery-image-container {
    width: 100%;
    max-width: 900px;
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.gallery-image-container img {
    max-width: 90%;
    max-height: 60vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(255, 165, 0, 0.3);
    display: block;
    margin: 0 auto;
}

/* Navigation Controls Container */
.gallery-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.image-info {
    background: linear-gradient(to right, #FF6B00, #FFA500);
    color: #fff;
    padding: 12px 25px;
    border-radius: 25px;
    display: inline-block;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Gallery Navigation Buttons */
.gallery-nav {
    background-color: rgba(255, 165, 0, 0.95);
    color: #fff;
    border: 3px solid #FF6B00;
    padding: 15px 12px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
}

.gallery-nav:hover {
    background-color: #FF6B00;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(255, 107, 0, 0.9);
}

.gallery-nav:active {
    transform: scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-viewer {
        padding: 15px;
    }
    
    .gallery-controls {
        gap: 15px;
    }

    .gallery-nav {
        min-width: 45px;
        height: 45px;
        font-size: 20px;
        padding: 12px 10px;
    }

    .gallery-header h1 {
        font-size: 36px;
    }

    .gallery-title {
        font-size: 24px;
    }

    .close-gallery {
        font-size: 40px;
        right: 20px;
    }

    .gallery-image-container img {
        max-height: 50vh;
    }
    
    .image-info {
        font-size: 16px;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .gallery-header h1 {
        font-size: 28px;
    }

    .gallery-header p {
        font-size: 16px;
    }

    .thumbnail-info h3 {
        font-size: 18px;
    }

    .thumbnail-info p {
        font-size: 14px;
    }

    .gallery-nav {
        min-width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .image-info {
        font-size: 16px;
        padding: 10px 20px;
    }
    
    
    /* Make gallery modal content fit better on small screens */
    .gallery-modal-content {
        width: 95% !important;
        max-height: none !important;
        overflow-y: visible !important;
        padding: 10px !important;
        margin: 5vh auto 5vh auto !important;
    }
    /* Ensure gallery image viewer fits in viewport */
    .gallery-viewer {
        min-height: auto !important;
        max-height: 60vh !important;
    }
    
    .gallery-image-container img {
        max-height: 50vh !important;
    }
}

/* ============================================================================
   GALLERY MANAGEMENT SYSTEM STYLES
   ============================================================================ */

/* Gallery Card Placeholder */
.thumbnail-placeholder {
    width: 100%;
    height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    font-size: 48px;
    color: #999;
}

.thumbnail-placeholder br + text {
    font-size: 18px;
    margin-top: 10px;
}

/* Gallery Description in Overlay */
.gallery-description {
    font-size: 14px !important;
    opacity: 0.9;
    margin-top: 8px;
    line-height: 1.4;
}

/* Manage Gallery Button */
.manage-gallery-btn {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    border: 2px solid #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s ease;
    display: inline-block;
    width: auto;
    pointer-events: auto; /* Ensure button is always clickable */
    position: relative;
    z-index: 10; /* Ensure button is on top */
}

.manage-gallery-btn:hover {
    background: #fff;
    color: #FF6B00;
}

/* Mobile improvements for manage button */
@media (max-width: 768px) {
    .manage-gallery-btn {
        padding: 10px 18px;
        font-size: 16px;
        margin-top: 15px;
        min-height: 44px; /* Apple's recommended touch target size */
        display: block;
        width: 100%;
        text-align: center;
        background: rgba(255, 255, 255, 0.9); /* More visible on mobile */
        color: #FF6B00;
        border: 2px solid #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); /* Make it stand out */
    }
    
    .manage-gallery-btn:active {
        background: #fff;
        transform: scale(0.98);
    }
}

/* Gallery Image Grid (inside manage modal) */
.gallery-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 100px));
    grid-auto-flow: row dense;
    gap: 45px 12px; /* Large vertical gap for buttons, normal horizontal gap */
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #ddd;
    justify-content: start;
    justify-items: start;
}

/* Manage Gallery Modal Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 150px));
    grid-auto-flow: row dense;
    gap: 10px 20px; /* Reduced vertical gap since cards have margin-bottom */
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: rgba(58, 82, 100, 0.4);
    border-radius: 8px;
    border: 2px solid #FF6B00;
    justify-content: start;
    justify-items: start;
}

.image-card {
    position: relative;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: rgba(44, 62, 80, 0.8);
    border: 2px solid #FF6B00;
    width: 100px;
    height: 100px;
    overflow: hidden;
}

/* Image cards in .image-grid (manage gallery modal) */
.image-grid .image-card {
    width: 150px;
    height: 150px;
    overflow: visible; /* Allow buttons to show below */
    margin-bottom: 40px; /* Space for buttons */
    cursor: move;
    cursor: grab;
}

/* Drag and drop states */
.image-grid .image-card:active {
    cursor: grabbing;
}

.image-grid .image-card.dragging {
    opacity: 0.4;
}

.image-grid .image-card.drag-over {
    border: 2px dashed #FF6B00;
    background-color: rgba(255, 107, 0, 0.1);
}

/* Image wrapper to keep images clipped */
.image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 6px;
}

.image-grid .image-wrapper {
    width: 150px;
    height: 150px;
}

.image-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 107, 0, 0.4);
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-card-buttons {
    position: absolute;
    bottom: -32px; /* Place buttons below the image */
    left: 0;
    right: 0;
    display: flex;
    gap: 2px;
    justify-content: center;
    z-index: 10;
    padding: 0;
}

/* Larger buttons for .image-grid */
.image-grid .image-card-buttons {
    bottom: -38px;
    gap: 5px;
}

.set-cover-btn {
    background: rgba(255, 165, 0, 0.95);
    color: white;
    border: 1px solid #FF6B00;
    border-radius: 3px;
    padding: 2px 5px;
    font-size: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* Larger buttons in .image-grid */
.image-grid .set-cover-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: 2px solid #FF6B00;
}

.set-cover-btn:hover {
    background: rgba(255, 165, 0, 1);
    transform: scale(1.05);
    border-color: #FF6B00;
}

.set-cover-btn.active {
    background: rgba(255, 215, 0, 0.95);
    color: #333;
    border-color: #FFD700;
}


.delete-image-btn {
    background: rgba(255, 0, 0, 0.9);
    color: white;
    border: 1px solid #cc0000;
    border-radius: 3px;
    padding: 2px 5px;
    font-size: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* Larger delete button in .image-grid */
.image-grid .delete-image-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: 2px solid #cc0000;
}

.delete-image-btn:hover {
    background: rgba(220, 0, 0, 1);
    transform: scale(1.05);
    border-color: #990000;
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
    .gallery-image-grid {
        grid-template-columns: repeat(auto-fill, 90px);
        gap: 12px 10px;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 120px));
        gap: 60px 20px; /* More vertical gap and horizontal spacing */
        padding: 10px;
        justify-content: center;
    }
    
    .image-card {
        width: 90px;
        height: 90px;
    }
    
    .image-grid .image-card {
        width: 120px;
        height: 120px;
        margin-bottom: 0; /* Remove margin-bottom, use gap instead */
    }
    
    .image-grid .image-wrapper {
        width: 120px;
        height: 120px;
    }
    
    .image-grid .set-cover-btn,
    .image-grid .delete-image-btn {
        font-size: 9px;
        padding: 3px 5px;
    }
    
    .set-cover-btn,
    .delete-image-btn {
        font-size: 7px;
        padding: 2px 4px;
    }
    
    .image-card-buttons {
        bottom: -30px;
    }
    
    .image-grid .image-card-buttons {
        bottom: -35px;
        gap: 3px;
    }
}

@media (max-width: 480px) {
    .gallery-image-grid {
        grid-template-columns: repeat(auto-fill, 80px);
        gap: 10px 8px;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 110px));
        gap: 40px 12px;
    }
    
    .image-card {
        width: 80px;
        height: 80px;
    }
    
    .image-grid .image-card {
        width: 110px;
        height: 110px;
    }
    
    .image-grid .set-cover-btn,
    .image-grid .delete-image-btn {
        font-size: 9px;
        padding: 2px 5px;
    }
    
    .image-card-buttons {
        bottom: -28px;
        gap: 1px;
    }
    
    .image-grid .image-card-buttons {
        bottom: -34px;
        gap: 3px;
    }
    
    .set-cover-btn,
    .delete-image-btn {
        font-size: 7px;
        padding: 1px 3px;
    }
}

/* Manage Gallery Modal Actions */
.manage-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.manage-actions button {
    flex: 1;
    min-width: 150px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #FF6B00;
    color: white;
}

.btn-primary:hover {
    background: #e65c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
}

.btn-secondary {
    background: #FFA500;
    color: white;
}

.btn-secondary:hover {
    background: #ff9500;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Form Styles for Modals */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #333;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Montserrat', Arial, sans-serif;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: #FF6B00;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Modal Title Styles */
.modal h2 {
    color: #FF6B00;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #FFA500;
}

/* Upload Controls */
#uploadControls {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #FF6B00 0%, #FFA500 100%);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.3);
}

#createGalleryBtn {
    background: white;
    color: #FF6B00;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#createGalleryBtn:hover {
    background: #FFE5CC;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Hidden file input */
#galleryImageUploader {
    display: none;
}

/* Loading Indicator */
/* Loading Indicator - Full screen with spinner */
#loading, #sending {
    display: none; /* Initially hidden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    font-size: 2em;
    color: #000;
    background-color: rgba(255, 255, 255, 0.95); /* Translucent white background */
    border-radius: 0px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* Subtle shadow effect */
    z-index: 9999; /* Ensure it is above other content */
    text-align: center;
    padding: 20px;
}

#loading::after, #sending::after {
    content: '';
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 10px solid rgba(255, 127, 0, 0.5);
    border-top: 10px solid rgba(255, 127, 0, 0.4); /* Solid orange color */
    border-right: 10px solid rgba(255, 127, 0, 0.3);
    border-left: 10px solid rgba(255, 127, 0, 0.3);
    border-bottom: 10px solid rgba(255, 127, 0, 0.4); 
    animation: spin 2s linear infinite;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 5px rgba(255, 127, 0, 0.7), 0 0 10px rgba(255, 127, 0, 0.5); /* Add inner glow */
    filter: drop-shadow(0 0 5px rgba(255, 127, 0, 0.6)) drop-shadow(0 0 10px rgba(255, 127, 0, 0.4)); /* Add outer glow and inner glow */
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================================================
   FOOTER STYLING - Better Link Visibility
   ============================================================================ */

#footer a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    transition: all 0.3s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#footer a:hover {
    color: #FFE5CC;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    text-decoration: underline;
}

/* ============================================================================
   SCROLLBAR VISIBILITY
   ============================================================================ */

html {
    overflow-y: scroll; /* Force scrollbar to always show */
    scroll-behavior: smooth;
}

body {
    overflow-y: scroll !important;
    overflow-x: hidden;
    height: 100%;
}

.gallery-section {
    overflow: visible;
    position: relative;
}

/* Custom scrollbar styling for better visibility */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
    border: 1px solid #ddd;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #FF6B00 0%, #FFA500 100%);
    border-radius: 10px;
    border: 2px solid #f1f1f1;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #e65c00 0%, #ff9500 100%);
}

/* Firefox scrollbar */
* {
    scrollbar-width: auto;
    scrollbar-color: #FF6B00 #f1f1f1;
}

/* User Management Styles */
.disabled-button {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc !important;
}

.disabled-button:hover {
    background-color: #ccc !important;
    transform: none !important;
}

/* ============================================================================
   FLASH MESSAGES - Modern Construction-Themed Notifications
   ============================================================================ */

#flash-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: auto;
    pointer-events: none;
}

.flash-message {
    background: linear-gradient(135deg, 
                rgba(44, 62, 80, 0.98) 0%, 
                rgba(52, 73, 94, 0.98) 100%);
    border-left: 5px solid #FF6B00;
    border-radius: 8px;
    padding: 18px 24px;
    margin-bottom: 15px;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 107, 0, 0.3);
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.4s ease-out, fadeOut 0.4s ease-out 4.6s forwards;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.flash-message::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #FF6B00, #FFA500);
    animation: progressBar 5s linear forwards;
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

.flash-message.success {
    border-left-color: #4CAF50;
}

.flash-message.success::before {
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
}

.flash-message.error {
    border-left-color: #f44336;
}

.flash-message.error::before {
    background: linear-gradient(90deg, #f44336, #ef5350);
}

.flash-message.warning {
    border-left-color: #FFD700;
}

.flash-message.warning::before {
    background: linear-gradient(90deg, #FFD700, #FFA500);
}

.flash-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.flash-content {
    flex: 1;
}

.flash-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.flash-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(120%);
    }
}

@media only screen and (max-width: 600px) {
    #flash-container {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .flash-message {
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .flash-icon {
        font-size: 20px;
    }
}

/* Users Modal Styling - Remove ALL white backgrounds */
#manageUsersModal .modal-content {
    background-color: rgba(44, 62, 80, 0.98) !important;
    color: #ffffff !important;
    border: 3px solid #FF6B00;
}

#manageUsersModal table {
    width: 100%;
    border-collapse: collapse;
    background-color: transparent !important;
    margin-top: 15px;
}

#manageUsersModal thead {
    background-color: rgba(58, 82, 100, 0.5) !important;
}

#manageUsersModal th {
    padding: 12px;
    text-align: left;
    color: #FFA500 !important;
    font-weight: bold;
    border-bottom: 2px solid #FF6B00;
    background-color: transparent !important;
}

#manageUsersModal tbody tr {
    background-color: rgba(58, 82, 100, 0.3) !important;
    border-bottom: 1px solid rgba(255, 107, 0, 0.3);
    transition: background-color 0.2s ease;
}

#manageUsersModal tbody tr:hover {
    background-color: rgba(80, 110, 130, 0.4) !important;
}

#manageUsersModal td {
    padding: 10px 12px;
    color: #ffffff !important;
    background-color: transparent !important;
}

#manageUsersModal button {
    padding: 6px 12px;
    margin: 2px;
    background: linear-gradient(135deg, #FF6B00 0%, #FFA500 100%);
    color: white !important;
    border: 2px solid #fff;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

#manageUsersModal button:hover {
    background: linear-gradient(135deg, #e65c00 0%, #ff9500 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 107, 0, 0.4);
}

#manageUsersModal a {
    color: #FFA500 !important;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s ease;
}

#manageUsersModal a:hover {
    color: #FF6B00 !important;
    text-decoration: underline;
}

/* Profile Modal - Ensure no white backgrounds */
#profileModal .modal-content {
    background-color: rgba(44, 62, 80, 0.98) !important;
    color: #ffffff !important;
    border: 3px solid #FF6B00;
}

#profileModal h2 {
    color: #FFA500 !important;
    text-align: center;
    margin-bottom: 20px;
}

#profileModal label {
    color: #ffffff !important;
    font-weight: bold;
    margin-top: 10px;
}

#profileModal input[type="text"],
#profileModal input[type="email"],
#profileModal input[type="password"] {
    background-color: rgba(100, 130, 150, 0.5) !important;
    color: #ffffff !important;
    border: 3px solid #FF6B00 !important;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

#profileModal input:focus {
    background-color: rgba(120, 150, 170, 0.6) !important;
    border-color: #FFA500 !important;
    border-width: 4px !important;
    outline: none;
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.4);
}

#profileModal button {
    background: linear-gradient(135deg, #FF6B00 0%, #FFA500 100%);
    color: white !important;
    border: 2px solid #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin: 5px 0;
    transition: all 0.3s ease;
}

#profileModal button:hover {
    background: linear-gradient(135deg, #e65c00 0%, #ff9500 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.5);
}

#profileMessage {
    background-color: rgba(40, 167, 69, 0.2) !important;
    color: #5FD35F !important;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #5FD35F;
}

#profileErrorMessage {
    background-color: rgba(220, 53, 69, 0.2) !important;
    color: #FF6B6B !important;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #FF6B6B;
}

/* Hide the default file input and its button completely */
input[type="file"] {
    position: absolute !important;
    left: -9999px !important; /* keep it focusable via label */
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
}

/* File upload button styling - MUST override modal-content label */
#projectContactForm label.custom-file-upload,
.custom-file-upload,
label.custom-file-upload,
.modal-content label.custom-file-upload,
#contactModal label[for="attachment"] {
    padding: 5px !important;
    background-color: #e0e0e0 !important;
    color: #000000 !important;
    border: 2px solid #000 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    text-align: center !important;
    display: inline-block !important;
    max-width: 80px !important;
    min-width: 60px !important;
    white-space: wrap !important;
    text-shadow: none !important;
    margin-bottom: 5px !important;
    font-weight: normal !important;
    box-sizing: border-box !important;
}

@media only screen and (max-width: 600px) {
    .custom-file-upload {
        width: 40%;
    }
}

#projectContactForm label.custom-file-upload:hover,
.custom-file-upload:hover,
label.custom-file-upload:hover,
.modal-content label.custom-file-upload:hover,
#contactModal label[for="attachment"]:hover {
    background-color: #ffd633 !important;
    color: #000000 !important;
}

/* Contact section styles */
.contact-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.contact-section h2,
.modal-content .contact-section h2,
#contactModal .contact-section h2 {
  margin: auto !important;
  padding-bottom: 10px !important;
  border-bottom: 2px solid #FFA500 !important; /* Orange underline */
  margin-bottom: 15px !important;
  display: inline-block !important;
}

.contact-section p {
  margin: auto;
}

.contact-section a:hover {
  text-decoration: underline;
  color: #d08401;
}

/* File attachment display styling */
#fileList {
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding: 8px 12px;
  background-color: rgba(58, 82, 100, 0.3);
  color: #ffffff;
  border: 2px solid #FF6B00;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.2s ease;
}

.file-detail:hover {
  background-color: rgba(80, 110, 130, 0.4);
  border-color: #FFA500;
}

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px;
  font-weight: 500;
}

.file-size {
  color: #FFA500;
  font-weight: bold;
  margin-right: 10px;
  white-space: nowrap;
}

.remove-file {
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-radius: 50%;
    border: 2px solid #fff;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
    padding: 0;
}

.remove-file:hover {
  background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4);
}

#totalSize {
  display: block;
  margin: 10px 0;
  font-size: 16px;
  font-weight: bold;
  color: #5FD35F;
  transition: color 0.3s ease;
}

.file-types-info {
  font-size: 13px;
  color: #FFA500;
  margin-bottom: 10px;
  font-style: italic;
}
