/**
 * Registration Sabba - Modern & Elegant Styles
 * Version: 1.0
 * Author: Sabba Cosimo
 */

/* Reset e variabili CSS */
:root {
    --rs-primary: #2563eb;
    --rs-primary-dark: #1d4ed8;
    --rs-primary-light: #3b82f6;
    --rs-success: #10b981;
    --rs-error: #ef4444;
    --rs-text-primary: #1f2937;
    --rs-text-secondary: #6b7280;
    --rs-border: #e5e7eb;
    --rs-background: #f9fafb;
    --rs-white: #ffffff;
    --rs-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --rs-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --rs-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --rs-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --rs-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container principale */
.rs-registration-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Card principale */
.rs-registration-card {
    background: var(--rs-white);
    border-radius: 1.5rem;
    box-shadow: var(--rs-shadow-xl);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 480px;
    animation: rs-fadeInUp 0.6s ease-out;
}

/* Header */
.rs-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.rs-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--rs-primary) 0%, var(--rs-primary-light) 100%);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    box-shadow: var(--rs-shadow-lg);
    animation: rs-pulse 2s infinite;
}

.rs-icon {
    width: 40px;
    height: 40px;
    stroke-width: 2;
    color: var(--rs-white);
}

.rs-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--rs-text-primary);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
}

.rs-subtitle {
    font-size: 1rem;
    color: var(--rs-text-secondary);
    margin: 0;
}

/* Form */
.rs-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rs-form-group {
    position: relative;
}

/* Input wrapper con icona */
.rs-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.rs-input-icon {
    position: absolute;
    left: 1rem;
    width: 20px;
    height: 20px;
    stroke-width: 2;
    color: var(--rs-text-secondary);
    transition: var(--rs-transition);
    pointer-events: none;
    z-index: 1;
}

/* Input fields */
.rs-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1rem;
    border: 2px solid var(--rs-border);
    border-radius: 0.75rem;
    background: #e8f0fe;
    color: #000000;
    transition: var(--rs-transition);
    outline: none;
    font-family: inherit;
}

.rs-input:focus {
    border-color: var(--rs-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.rs-input:focus ~ .rs-label {
    transform: translateY(-2rem) scale(0.85);
    color: var(--rs-primary);
}

.rs-input:not(:placeholder-shown) ~ .rs-label {
    transform: translateY(-2rem) scale(0.85);
}

.rs-input:focus ~ .rs-input-icon,
.rs-input:not(:placeholder-shown) ~ .rs-input-icon {
    color: var(--rs-primary);
}

/* Label floating */
.rs-label {
    position: absolute;
    left: 3rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rs-text-secondary);
    font-size: 1rem;
    pointer-events: none;
    transition: var(--rs-transition);
    background: var(--rs-white);
    padding: 0 0.5rem;
    transform-origin: left center;
}

/* Checkbox personalizzato */
.rs-checkbox-group {
    margin-top: 0.5rem;
}

.rs-checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 2rem;
}

.rs-checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.rs-checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    border: 2px solid var(--rs-border);
    border-radius: 0.375rem;
    transition: var(--rs-transition);
    background: var(--rs-white);
}

.rs-checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid var(--rs-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.rs-checkbox-wrapper input:checked ~ .rs-checkmark {
    background: var(--rs-primary);
    border-color: var(--rs-primary);
}

.rs-checkbox-wrapper input:checked ~ .rs-checkmark::after {
    display: block;
}

.rs-checkbox-wrapper:hover .rs-checkmark {
    border-color: var(--rs-primary);
}

.rs-checkbox-label {
    color: var(--rs-text-secondary);
    font-size: 0.875rem;
}

/* Bottoni Radio moderni senza pallino */
.rs-user-type-selector {
    margin-bottom: 1.5rem;
}

.rs-user-type-selector > label:first-child {
    display: block;
    font-weight: 600;
    color: var(--rs-text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.rs-radio-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.rs-radio-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--rs-border);
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--rs-white);
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 130px;
}

/* Elegante effetto shimmer */
.rs-radio-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(37, 99, 235, 0.12), 
        transparent
    );
    transition: left 0.6s ease;
}

/* Bordo animato per stato attivo */
.rs-radio-option::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 2rem;
    background: linear-gradient(45deg, 
        var(--rs-primary), 
        var(--rs-primary-light), 
        var(--rs-primary)
    );
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: rs-border-glow 2s linear infinite;
}

.rs-radio-option:hover::before {
    left: 100%;
}

.rs-radio-option:hover {
    border-color: var(--rs-primary-light);
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 35px rgba(37, 99, 235, 0.2);
}

.rs-radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Label elegante */
.rs-radio-label {
    font-weight: 500;
    color: var(--rs-text-primary);
    font-size: 0.9rem;
    letter-spacing: 0.025em;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

/* Stato attivo - bottone selezionato con colore personalizzato */
.rs-radio-option:has(input:checked) {
    border-color: #548dc5;
    background: #548dc5;
    box-shadow: 0 8px 25px rgba(84, 141, 197, 0.4);
    transform: translateY(-2px);
    animation: rs-button-selected 0.5s ease;
}

.rs-radio-option:has(input:checked)::after {
    opacity: 0; /* Rimuovo il bordo animato per il colore solido */
}

.rs-radio-option input:checked ~ .rs-radio-label {
    color: #ffffff !important;
    font-weight: 600;
    animation: rs-text-glow 0.4s ease;
}

/* Forza colori per tutti gli stati dei bottoni radio */
.rs-radio-option,
.rs-radio-option:hover,
.rs-radio-option:focus,
.rs-radio-option:active {
    background: #e8f0fe !important;
}

.rs-radio-option .rs-radio-label,
.rs-radio-option:hover .rs-radio-label,
.rs-radio-option:focus .rs-radio-label {
    color: #000000 !important;
}

/* Mantieni sempre il colore e testo anche dopo le animazioni */
.rs-radio-option:has(input:checked),
.rs-radio-option:has(input:checked):hover,
.rs-radio-option:has(input:checked):focus {
    background: #548dc5 !important;
    border-color: #548dc5 !important;
}

.rs-radio-option:has(input:checked) .rs-radio-label,
.rs-radio-option:has(input:checked):hover .rs-radio-label,
.rs-radio-option:has(input:checked):focus .rs-radio-label {
    color: #ffffff !important;
}

/* Animazioni eleganti con nuovo colore */
@keyframes rs-button-selected {
    0% { 
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 rgba(84, 141, 197, 0);
    }
    50% { 
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 12px 30px rgba(84, 141, 197, 0.5);
    }
    100% { 
        transform: translateY(-2px) scale(1);
        box-shadow: 0 8px 25px rgba(84, 141, 197, 0.4);
    }
}

@keyframes rs-text-glow {
    0% { 
        transform: scale(1);
        text-shadow: none;
    }
    50% { 
        transform: scale(1.02);
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    }
    100% { 
        transform: scale(1);
        text-shadow: none;
    }
}

@keyframes rs-border-glow {
    0% { 
        background: linear-gradient(45deg, 
            var(--rs-primary), 
            var(--rs-primary-light), 
            var(--rs-primary)
        );
    }
    50% { 
        background: linear-gradient(45deg, 
            var(--rs-primary-light), 
            var(--rs-primary), 
            var(--rs-primary-light)
        );
    }
    100% { 
        background: linear-gradient(45deg, 
            var(--rs-primary), 
            var(--rs-primary-light), 
            var(--rs-primary)
        );
    }
}

/* Focus accessibilità */
.rs-radio-option input:focus-visible {
    + .rs-radio-label {
        outline: 2px solid var(--rs-primary);
        outline-offset: 2px;
        border-radius: 0.25rem;
    }
}

.rs-radio-option:focus-within {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Responsive ottimizzato */
@media (max-width: 640px) {
    .rs-radio-group {
        flex-direction: column;
        gap: 0.6rem;
    }
    
    .rs-radio-option {
        justify-content: center;
        padding: 0.85rem 1.2rem;
        min-width: auto;
    }
    
    .rs-radio-label {
        font-size: 0.95rem;
    }
}

/* Messaggi */
.rs-message {
    padding: 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
    animation: rs-slideDown 0.3s ease-out;
}

.rs-message.rs-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--rs-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: block;
}

.rs-message.rs-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--rs-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: block;
}

/* Pulsante submit */
.rs-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--rs-white);
    background: linear-gradient(135deg, var(--rs-primary) 0%, var(--rs-primary-light) 100%);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--rs-transition);
    box-shadow: var(--rs-shadow-md);
    margin-top: 0.5rem;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.rs-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.rs-submit-btn:hover::before {
    left: 100%;
}

.rs-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--rs-shadow-lg);
    background: linear-gradient(135deg, var(--rs-primary-dark) 0%, var(--rs-primary) 100%);
}

.rs-submit-btn:active {
    transform: translateY(0);
}

.rs-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.rs-btn-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    transition: var(--rs-transition);
}

.rs-submit-btn:hover .rs-btn-icon {
    transform: translateX(4px);
}

/* Loading spinner */
.rs-submit-btn.rs-loading .rs-btn-text {
    visibility: hidden;
}

.rs-submit-btn.rs-loading .rs-btn-icon {
    display: none;
}

.rs-submit-btn.rs-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--rs-white);
    border-radius: 50%;
    animation: rs-spin 0.6s linear infinite;
}

/* Footer */
.rs-footer {
    margin-top: 2rem;
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--rs-border);
}

.rs-footer p {
    color: var(--rs-text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.rs-link {
    color: var(--rs-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--rs-transition);
}

.rs-link:hover {
    color: var(--rs-primary-dark);
    text-decoration: underline;
}

/* Animazioni */
@keyframes rs-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rs-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes rs-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes rs-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .rs-registration-container {
        padding: 1rem;
    }
    
    .rs-registration-card {
        padding: 2rem 1.5rem;
    }
    
    .rs-title {
        font-size: 1.75rem;
    }
    
    .rs-icon-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .rs-icon {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 480px) {
    .rs-registration-card {
        padding: 1.5rem 1rem;
    }
    
    .rs-title {
        font-size: 1.5rem;
    }
    
    .rs-input {
        padding: 0.875rem 0.875rem 0.875rem 2.75rem;
    }
    
    .rs-submit-btn {
        padding: 0.875rem 1.5rem;
    }
}

/* Dark mode support (opzionale) */
@media (prefers-color-scheme: dark) {
    :root {
        --rs-text-primary: #f9fafb;
        --rs-text-secondary: #d1d5db;
        --rs-border: #374151;
        --rs-background: #1f2937;
        --rs-white: #111827;
    }
    
    .rs-registration-card {
        background: #1f2937;
    }
    
    .rs-input {
        background: #111827;
        color: #f9fafb;
    }
    
    .rs-label {
        background: #1f2937;
    }
    
    .rs-checkmark {
        background: #111827;
    }
}

/* Accessibilità */
.rs-input:focus-visible,
.rs-submit-btn:focus-visible,
.rs-checkbox-wrapper input:focus-visible ~ .rs-checkmark {
    outline: 2px solid var(--rs-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .rs-registration-container {
        background: white;
    }
}

/* ===== reCAPTCHA FRONTEND STYLES ===== */
.rs-recaptcha-notice {
    margin: 1rem 0;
    padding: 0.75rem;
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.2);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: var(--rs-text-secondary);
    text-align: center;
    line-height: 1.4;
}

.rs-recaptcha-notice a {
    color: var(--rs-primary);
    text-decoration: none;
    font-weight: 500;
}

.rs-recaptcha-notice a:hover {
    text-decoration: underline;
}

.rs-recaptcha-message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: rs-slideInDown 0.3s ease-out;
}

.rs-recaptcha-message::before {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rs-message-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #10b981;
    color: #065f46;
}

.rs-message-success::before {
    background: #10b981;
}

.rs-message-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border: 1px solid #ef4444;
    color: #991b1b;
}

.rs-message-error::before {
    background: #ef4444;
}

.rs-message-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #3b82f6;
    color: #1e40af;
}

.rs-message-info::before {
    background: #3b82f6;
    animation: rs-spin 1s linear infinite;
}

@keyframes rs-slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rs-spin {
    to { transform: rotate(360deg); }
}

/* reCAPTCHA v2 Styles */
.rs-recaptcha-group {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.rs-recaptcha-group .g-recaptcha {
    transform: scale(0.9);
    transform-origin: center;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--rs-shadow-sm);
}

/* reCAPTCHA responsive adjustments */
@media (max-width: 480px) {
    .rs-recaptcha-group .g-recaptcha {
        transform: scale(0.85);
    }
}

@media (max-width: 320px) {
    .rs-recaptcha-group .g-recaptcha {
        transform: scale(0.75);
    }
}