/**
 * Lead Catalog Form Styles
 * Stili personalizzati per il form di richiesta catalogo turismo scolastico
 */

/* Custom Radio Buttons */
.radio-custom {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.radio-custom:checked {
    border-color: #2563eb;
    background-color: #2563eb;
}

.radio-custom:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
}

.radio-custom:hover {
    border-color: #3b82f6;
}

.radio-custom:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Error states for radio buttons */
.radio-custom.border-red-500 {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Custom Checkboxes */
.checkbox-custom {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-custom:checked {
    border-color: #2563eb;
    background-color: #2563eb;
}

.checkbox-custom:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-custom:hover {
    border-color: #3b82f6;
}

.checkbox-custom:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Error states for checkboxes */
.checkbox-custom.border-red-500 {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Modern Shadow */
.modern-shadow {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Form Validation States */
.field-error {
    font-size: 0.875rem;
    color: #ef4444;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
}

.field-error::before {
    content: '⚠';
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

/* Radio group and checkbox specific errors */
.radio-group-error,
.checkbox-error {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    font-weight: 500;
}

/* Input field error states */
input.border-red-500 {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

input.border-red-500:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* Stile specifico per campo numerico cellulare */
input[name="cellulare"] {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.025em;
}

input[name="cellulare"]::placeholder {
    font-style: italic;
    color: #9ca3af;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
    }
}

.shake-error {
    animation: shake 0.5s ease-in-out;
}

/* Toast Animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-enter {
    animation: slideInRight 0.3s ease-out;
}

.toast-exit {
    animation: slideOutRight 0.3s ease-out;
}

/* Toast specific styles */
#toast-container {
    z-index: 99999 !important;
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    pointer-events: none !important;
    width: 300px !important;
    min-height: 60px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    background-color: white !important;
    border: 2px solid #333 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
}

#toast-container:not(.hidden) {
    pointer-events: auto !important;
}

#toast-message {
    pointer-events: auto !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* Force visibility overrides */
#toast-container.hidden {
    display: none !important;
}

#toast-container.translate-x-0 {
    transform: translateX(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#toast-container.translate-x-full {
    transform: translateX(100%) !important;
}

/* Mobile improvements */
@media (max-width: 640px) {
    #toast-container {
        left: 1rem !important;
        right: 1rem !important;
        max-width: calc(100vw - 2rem) !important;
        width: auto !important;
    }

    #toast-container.translate-x-full {
        transform: translateX(calc(100vw)) !important;
    }
}

/* Loading Button Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Responsive Improvements */
@media (max-width: 640px) {
    .radio-custom,
    .checkbox-custom {
        width: 18px;
        height: 18px;
    }

    .checkbox-custom:checked::after {
        left: 4px;
        width: 5px;
        height: 8px;
    }

    .radio-custom:checked::after {
        width: 6px;
        height: 6px;
    }
}

/* Focus Accessibility */
.radio-custom:focus,
.checkbox-custom:focus,
input:focus,
button:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .radio-custom,
    .checkbox-custom {
        border-width: 3px;
    }

    .radio-custom:checked,
    .checkbox-custom:checked {
        background-color: #000;
        border-color: #000;
    }

    .field-error {
        font-weight: bold;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .radio-custom,
    .checkbox-custom,
    button {
        transition: none;
    }

    .animate-spin {
        animation: none;
    }

    .toast-enter,
    .toast-exit {
        animation: none;
    }
}
