/**
 * Construction-themed loading animation styles
 * For use across all Varahi Construction pages
 */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}

.loading-logo {
    width: 60px;
    height: auto;
    margin-bottom: 15px;
}

body.loading {
    overflow: hidden;
}

/* Construction-themed loading animation */
.construction-beam {
    position: absolute;
    width: 120px;
    height: 8px;
    background: linear-gradient(90deg, #ff6b00, #ff9d00);
    border-radius: 4px;
    transform-origin: center;
    animation: beam-move 1.2s ease-in-out infinite;
    box-shadow: 0 2px 10px rgba(255, 107, 0, 0.3);
}

.construction-crane {
    position: absolute;
    width: 80px;
    height: 80px;
}

.crane-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 60px;
    background-color: #2c3e50;
    border-radius: 2px;
}

.crane-arm {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 4px;
    transform-origin: center left;
    animation: crane-rotate 2s ease-in-out infinite;
}

.crane-weight {
    position: absolute;
    top: 8px;
    left: 15px;
    width: 12px;
    height: 12px;
    background-color: #7f8c8d;
    border-radius: 2px;
    animation: crane-weight 2s ease-in-out infinite;
}

.crane-hook {
    position: absolute;
    top: 8px;
    right: 5px;
    width: 10px;
    height: 16px;
    border: 3px solid #95a5a6;
    border-top: none;
    border-radius: 0 0 5px 5px;
    animation: crane-hook 2s ease-in-out infinite;
}

.construction-building {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.building-floor {
    width: 80%;
    height: 8px;
    background-color: #3498db;
    margin-bottom: 3px;
    border-radius: 2px;
    animation: floor-appear 0.8s ease-out;
    animation-fill-mode: both;
}

.building-floor:nth-child(1) {
    animation-delay: 0.1s;
}

.building-floor:nth-child(2) {
    animation-delay: 0.3s;
}

.building-floor:nth-child(3) {
    animation-delay: 0.5s;
}

@keyframes beam-move {
    0%, 100% {
        transform: translateX(-40px) rotate(-10deg);
    }
    50% {
        transform: translateX(40px) rotate(10deg);
    }
}

@keyframes crane-rotate {
    0%, 100% {
        transform: translateX(-50%) rotate(-10deg);
    }
    50% {
        transform: translateX(-50%) rotate(10deg);
    }
}

@keyframes crane-weight {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(5px);
    }
}

@keyframes crane-hook {
    0%, 100% {
        transform: translateY(0) rotate(0);
    }
    50% {
        transform: translateY(8px) rotate(5deg);
    }
}

@keyframes floor-appear {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.loading-text {
    margin-top: 15px;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.loading-text:after {
    content: '...';
    overflow: hidden;
    display: inline-block;
    vertical-align: bottom;
    animation: ellipsis steps(4, end) 1s infinite;
    width: 0;
}

@keyframes ellipsis {
    to {
        width: 20px;
    }
}

/* Animation preloader optimization */
.loading-overlay * {
    will-change: transform, opacity;
}

/* Form Success and Error Popups */
.form-success-popup,
.form-error-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.form-success-popup.show,
.form-error-popup.show {
    opacity: 1;
    visibility: visible;
}

.form-success-popup .popup-content,
.form-error-popup .popup-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.form-success-popup.show .popup-content,
.form-error-popup.show .popup-content {
    transform: scale(1);
}

.form-success-popup .success-icon {
    color: #00c853;
    font-size: 64px;
    margin-bottom: 20px;
}

.form-error-popup .error-icon {
    color: #f44336;
    font-size: 64px;
    margin-bottom: 20px;
}

.form-success-popup p,
.form-error-popup p {
    color: #333;
    font-size: 18px;
    margin: 0 0 10px;
    line-height: 1.5;
}

.form-success-popup .redirect-text {
    font-size: 14px;
    color: #666;
    margin-top: 15px;
}

@media (max-width: 576px) {
    .form-success-popup .popup-content,
    .form-error-popup .popup-content {
        padding: 20px;
    }
    
    .form-success-popup .success-icon,
    .form-error-popup .error-icon {
        font-size: 48px;
        margin-bottom: 15px;
    }
    
    .form-success-popup p,
    .form-error-popup p {
        font-size: 16px;
    }
}

/* Additional success message style - for backwards compatibility */
.success-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 1;
    transition: opacity 0.5s ease;
}

.success-message i {
    margin-right: 10px;
    font-size: 1.2em;
} 