/* Contact Form Message Styling */

.form-message {
    margin: 20px 0;
    padding: 0;
    min-height: 0;
    opacity: 0;
    transition: all 0.3s ease;
}

/* Ensure message container sits above nearby elements and can show animations */
.form-message {
    position: relative;
    z-index: 5;
}

.form-message.loading,
.form-message.success,
.form-message.error {
    opacity: 1;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.form-message.loading {
    background: linear-gradient(135deg, var(--ht-theme-color-3, #667eea) 0%, var(--ht-theme-color-2, #764ba2) 100%);
    color: var(--ht-white, #ffffff);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.message-loading {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    -webkit-animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.message-loading p {
    font-size: 16px;
    font-weight: 600;
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    border-radius: 10px;
    animation: progress 2s ease-in-out infinite;
    -webkit-animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0;
    }

    50% {
        width: 100%;
    }

    100% {
        width: 0;
    }
}

/* Success State */
.form-message.success {
    background: linear-gradient(135deg, var(--ht-theme-color, #84fab0) 0%, var(--ht-theme-color-3, #8fd3f4) 100%);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(132, 250, 176, 0.12);
}

.message-success {
    text-align: center;
}

/* Success icon */
.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: white;
    border-radius: 50%;
    color: var(--ht-theme-color, #84fab0);
    animation: successBounce 0.6s ease;
    -webkit-animation: successBounce 0.6s ease;
    will-change: transform, opacity;
}

.success-icon svg {
    width: 32px;
    height: 32px;
}

@keyframes successBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Success text and reference styling (improved contrast) */
.message-success h3 {
    font-size: 24px;
    color: var(--ht-heading-color, #0b2c3a);
    margin: 15px 0 10px 0;
    font-weight: 700;
}

.message-success p {
    color: var(--ht-heading-color, #0b2c3a);
    font-size: 15px;
    line-height: 1.6;
    margin: 10px 0;
}

.reference-id {
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 20px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
    color: var(--ht-heading-color, #0b2c3a);
    border-left: 4px solid var(--ht-theme-color, #84fab0);
}

.reference-id strong {
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.message-text {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 10px;
    color: var(--ht-heading-color, #0b2c3a);
}

/* Error State */
.form-message.error {
    background: linear-gradient(135deg, var(--ht-danger, #ff6b6b) 0%, var(--ht-danger-2, #ee5a6f) 100%);
    color: var(--ht-white, #ffffff);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

.message-error {
    text-align: center;
}

.error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: white;
    border-radius: 50%;
    color: var(--ht-danger, #ff6b6b);
    animation: errorShake 0.5s ease;
}

.error-icon svg {
    width: 32px;
    height: 32px;
}

@keyframes errorShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.message-error h3 {
    font-size: 24px;
    color: var(--ht-white, #ffffff);
    margin: 15px 0 10px 0;
    font-weight: 700;
}

.message-error p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    line-height: 1.6;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 600px) {

    .form-message.loading,
    .form-message.success,
    .form-message.error {
        padding: 20px;
    }

    .message-success h3,
    .message-error h3 {
        font-size: 20px;
    }

    .message-success p,
    .message-error p {
        font-size: 14px;
    }

    .success-icon,
    .error-icon {
        width: 50px;
        height: 50px;
    }

    .success-icon svg,
    .error-icon svg {
        width: 28px;
        height: 28px;
    }
}

/* More specific selectors to override competing styles and ensure animations run */
.form-message .spinner,
.form-message.loading .spinner,
.form-message.success .spinner,
.form-message.error .spinner {
    animation: spin 1s linear infinite !important;
    -webkit-animation: spin 1s linear infinite !important;
    border-top-color: #ffffff !important;
}

.form-message .progress-fill,
.form-message.loading .progress-fill {
    animation: progress 2s ease-in-out infinite !important;
    -webkit-animation: progress 2s ease-in-out infinite !important;
}

.form-message .success-icon {
    animation: successBounce 0.6s ease !important;
    -webkit-animation: successBounce 0.6s ease !important;
}

.form-message .error-icon {
    animation: errorShake 0.5s ease !important;
    -webkit-animation: errorShake 0.5s ease !important;
}