/**
 * RoyLead Forms Styles
 */

/* Form Container */
.roylead-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Form Groups */
.roylead-form-group {
    margin-bottom: 20px;
}

.roylead-form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.roylead-form-row .roylead-form-group {
    flex: 1;
    min-width: 200px;
}

/* Labels */
.roylead-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

/* Form Controls */
.roylead-form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.roylead-form-control:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.roylead-form-control:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Buttons */
.roylead-form button[type="submit"] {
    display: block;
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.roylead-form button[type="submit"]:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.roylead-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */
.roylead-form-message {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.roylead-form-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.roylead-form-message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Email Form Wrapper */
.roylead-email-form-wrapper {
    max-width: 500px;
    margin: 40px auto;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
}

.roylead-email-form-wrapper h3 {
    margin-bottom: 10px;
    color: #333;
}

.roylead-email-form-wrapper p {
    margin-bottom: 20px;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .roylead-form-row {
        flex-direction: column;
    }

    .roylead-form-row .roylead-form-group {
        min-width: 100%;
    }
}

/* Google Autocomplete Customization */
.pac-container {
    z-index: 99999;
}

.pac-item {
    padding: 10px;
    font-size: 14px;
}

.pac-item:hover {
    background-color: #f5f5f5;
}

/* Loading State */
.roylead-form.loading .roylead-form-control {
    opacity: 0.6;
    pointer-events: none;
}

.roylead-form.loading button[type="submit"] {
    position: relative;
}

.roylead-form.loading button[type="submit"]:after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    border: 2px solid transparent;
    border-top-color: #fff;
    border-radius: 50%;
    animation: roylead-spinner 0.8s linear infinite;
}

@keyframes roylead-spinner {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Validation States */
.roylead-form-control.error {
    border-color: #dc3545;
}

.roylead-form-control.success {
    border-color: #28a745;
}

/* Client-Side Validation Errors */
.roylead-field-invalid {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
}

.roylead-field-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

.roylead-field-error {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #dc3545;
    font-weight: 500;
}

/* Helper Text */
.roylead-form-help {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #6c757d;
}

/* Spinner */
.roylead-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: roylead-spin 0.8s linear infinite;
}

@keyframes roylead-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Stato disabilitato per i bottoni */
.roylead-form button[type="submit"]:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    position: relative;
}

/* Se usi classi Bootstrap */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Assicura che lo spinner sia centrato */
.roylead-form button[type="submit"]:disabled .roylead-spinner {
    margin: 0 auto;
    display: block;
}

/* Forza visibilità e stili del pulsante */
.roylead-form button[type="submit"],
.roylead-form .btn {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background-color: #007cba;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.roylead-form button[type="submit"]:hover {
    background-color: #005a87;
}