/* Custom Contact Form Styles */
.custom-contact-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #e04e39;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.contact-form-title {
    text-align: center;
    color: #fff;
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 600;
}

.custom-contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group--privacy {
    margin-top: 4px;
}

.contact-privacy-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.35;
    color: #fff;
    cursor: pointer;
}

.contact-privacy-label input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.contact-privacy-label a {
    color: #fff;
    text-decoration: underline;
}

.contact-privacy-label a:hover {
    text-decoration: none;
    opacity: 0.9;
}

.form-group label {
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-form-submit {
    background: #fff;
    color: #e04e39;
    border: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.contact-form-submit:hover {
    background: #f5f5f5;
    color: #e04e39;
}

.contact-form-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.form-messages {
    margin-top: 15px;
}

.form-message {
    padding: 12px;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-contact-form-wrapper {
        margin: 0 10px;
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .contact-form-title {
        font-size: 1.5rem;
    }
    
    .contact-form-submit {
        padding: 12px 25px;
        font-size: 1rem;
    }
}

/* Integration with existing theme */
.servizi-contact-section .custom-contact-form-wrapper {
    background: #e04e39;
    box-shadow: none;
    border: none;
}

.servizi-contact-section .contact-form-title {
    color: #fff;
    border-bottom: 2px solid #fff;
    padding-bottom: 10px;
}

/* Variante marketing: layout a colonna singola, simile al mockup */
.custom-contact-form-wrapper--marketing {
    max-width: 480px;
}

.custom-contact-form--marketing {
    gap: 16px;
}

.custom-contact-form--marketing .form-group {
    width: 100%;
}

/* Popup di ringraziamento */
.contact-form-thankyou-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.contact-form-thankyou-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.contact-form-thankyou-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.contact-form-thankyou-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.contact-form-thankyou-close:hover {
    color: #333;
}

.contact-form-thankyou-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #ffffff;
    font-weight: bold;
    animation: iconBounce 0.5s ease-out;
}

@keyframes iconBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.contact-form-thankyou-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 15px 0;
}

.contact-form-thankyou-message {
    font-size: 16px;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 30px 0;
}

.contact-form-thankyou-button {
    background: #e04e39;
    color: #ffffff;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.contact-form-thankyou-button:hover {
    background: #c74432;
}

/* Responsive per popup */
@media (max-width: 768px) {
    .contact-form-thankyou-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .contact-form-thankyou-icon {
        width: 60px;
        height: 60px;
        font-size: 36px;
        margin-bottom: 15px;
    }
    
    .contact-form-thankyou-title {
        font-size: 24px;
    }
    
    .contact-form-thankyou-message {
        font-size: 14px;
    }
}