/* Caldarella Inquiry Form - Frontend Styles */
.wafp-form-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-family: system-ui, -apple-system, sans-serif;
}

.wafp-form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.wafp-form-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.wafp-form-subtitle {
    color: #666;
    font-size: 1rem;
}

.wafp-form-group {
    margin-bottom: 1.5rem;
}

.wafp-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.wafp-form-input,
.wafp-form-select,
.wafp-form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    color: #333333;
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.wafp-form-select {
    min-height: 52px;
    height: auto;
    line-height: 1.5;
    padding: 0.85rem 2.5rem 0.85rem 0.75rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
    white-space: normal;
    overflow: visible;
    text-overflow: ellipsis;
}

.wafp-form-input:focus,
.wafp-form-select:focus,
.wafp-form-textarea:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.wafp-form-textarea {
    min-height: 100px;
    resize: vertical;
}

.wafp-form-required {
    color: #e74c3c;
}

.wafp-form-submit {
    width: 100%;
    padding: 1rem;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.wafp-form-submit:hover {
    background: #128C7E;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.wafp-form-submit:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wafp-form-submit:active {
    transform: translateY(0);
}

.wafp-whatsapp-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.15s ease;
}

.wafp-form-submit:hover .wafp-whatsapp-icon {
    transform: scale(1.1);
}

/* Messaggi di errore e successo con emoji */
.wafp-error {
    background: linear-gradient(135deg, #fee, #fdd);
    color: #c33;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #fcc;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wafp-error::before {
    content: "❌";
    font-size: 1.2rem;
}

.wafp-success {
    background: linear-gradient(135deg, #efe, #dfd);
    color: #363;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #cfc;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.wafp-success::before {
    content: "✅";
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.wafp-error-message {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: fadeIn 0.3s ease-out;
}

/* Animazioni */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Pulsante con effetto pulse durante il caricamento */
.wafp-form-submit:disabled {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

/* Stili per desktop e mobile differenziati */
@media (min-width: 1024px) {
    .wafp-form-container {
        margin: 2rem auto;
        max-width: 650px;
    }
    
    .wafp-form-submit {
        font-size: 1.15rem;
        padding: 1.25rem;
    }
    
    .wafp-form-submit::after {
        content: "🖥️ Apre WhatsApp Web";
        position: absolute;
        bottom: -30px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.75rem;
        opacity: 0.7;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .wafp-form-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .wafp-form-title {
        font-size: 1.5rem;
    }
    
    .wafp-form-submit::after {
        content: "📱 Apre App WhatsApp";
        position: absolute;
        bottom: -25px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.7rem;
        opacity: 0.7;
        white-space: nowrap;
    }
}

/* Miglioramenti per l'accessibilità */
.wafp-form-input:focus,
.wafp-form-select:focus,
.wafp-form-textarea:focus {
    border-color: #25D366;
    box-shadow: 
        0 0 0 3px rgba(37, 211, 102, 0.1),
        0 0 0 1px #25D366;
}

/* Dark mode: controllato dalla sezione Design del plugin */

/* Indicatori di caricamento migliorati */
.wafp-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Tooltip per dispositivi desktop */
@media (hover: hover) {
    .wafp-form-submit:hover::before {
        content: attr(data-tooltip);
        position: absolute;
        top: -40px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 0.5rem;
        border-radius: 4px;
        font-size: 0.75rem;
        white-space: nowrap;
        z-index: 1000;
    }
}
/* Fix click delay */
.wafp-form-container * {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* No transition delay on select */
.wafp-form-select {
    transition: none !important;
}

/* Instant click feedback */
.wafp-form-submit:active {
    transform: scale(0.97) !important;
    transition: none !important;
    opacity: 0.9;
}

.wafp-form-input:active,
.wafp-form-select:active {
    transition: none !important;
}

/* Disable all hover transitions on touch devices */
@media (hover: none) {
    .wafp-form-submit,
    .wafp-form-input,
    .wafp-form-select,
    .wafp-form-textarea {
        transition: none !important;
    }
}
