/**
 * Clanto Login - Form Login/Registrazione Unificato
 * Stili moderni e responsive per form multi-step
 */

/* ============================================
   Container Principale
   ============================================ */


.clantol-login-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.clantol-login-form {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ============================================
   Layout 2 Colonne (QR Code)
   ============================================ */

.clantol-login-columns {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Nascondi elementi desktop su mobile */
.desktop-only {
    display: none !important;
}

/* Mostra elementi mobile su mobile */
.mobile-only {
    display: block;
}

.clantol-column-right {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e0e0e0;
    margin: 0px 50px;
}

.clantol-qr-panel h3 {
    margin-top: 0;
    font-size: 20px;
}

/* ============================================
   Responsive (Tablet & Desktop)
   ============================================ */

@media screen and (min-width: 768px) {
    .clantol-login-form-wrapper {
        max-width: 900px; /* Più largo per accomodare 2 colonne */
    }

    .clantol-login-columns.has-qr {
        flex-direction: row;
        align-items: flex-start;
    }

    .clantol-column-left {
        flex: 1;
        padding: 0px 40px 0px 50px;
    }

    .clantol-column-right {
        flex: 0 0 320px; /* Larghezza fissa per QR panel */
        position: sticky;
        top: 20px;
    }

    /* Mostra elementi desktop su desktop */
    .desktop-only {
        display: block !important;
    }

    /* Nascondi elementi mobile su desktop */
    .mobile-only {
        display: none !important;
    }
    
    .clantol-qr-switch-container.mobile-only {
        display: none !important;
    }
}

/* ============================================
   Step Management
   ============================================ */

.clantol-form-step {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.clantol-form-step.active {
    display: block;
    margin: 0px 50px 0px 50px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Form Fields
   ============================================ */

.clantol-form-field {
    margin-bottom: 20px;
    position: relative;
}

.clantol-form-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1d2327;
    margin-bottom: 8px;
}

.clantol-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #fafafa;
}

.clantol-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.clantol-input::placeholder {
    color: #a0a5aa;
    transition: all 0.3s ease;
    transform-origin: left center;
}

.clantol-input:focus::placeholder {
    opacity: 0;
}

.clantol-form-field.has-floating-label {
    margin-top: 10px;
}

.clantol-form-field.has-floating-label label {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    font-size: 16px;
    color: #666;
    pointer-events: none;
    transition: all 0.2s ease;
    background: #fff;
    padding: 0 4px;
}

.clantol-form-field.has-floating-label .clantol-input {
    padding: 14px 18px;
}

.clantol-form-field.has-floating-label .clantol-input:focus ~ label,
.clantol-form-field.has-floating-label .clantol-input.has-value ~ label {
    top: -8px;
    left: 14px;
    font-size: 12px;
    color: #2271b1;
    font-weight: 500;
    background: #fff;
}

/* ============================================
   Password Field con Freccetta
   ============================================ */

.clantol-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clantol-password-wrapper .clantol-input {
    flex: 1;
    padding-right: 50px;
}

.clantol-btn-submit-arrow {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    background: #2271b1;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.2);
}

.clantol-btn-submit-arrow svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.clantol-btn-submit-arrow:hover {
    background: #135e96;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
    transform: translateY(-50%) translateX(2px);
}

.clantol-btn-submit-arrow:hover svg {
    transform: translateX(2px);
}

.clantol-btn-submit-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

/* ============================================
   Buttons
   ============================================ */

.clantol-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.clantol-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
}

.clantol-btn-primary {
    background: #2271b1;
    color: #fff;
}

.clantol-btn-primary:hover {
    background: #135e96;
}

.clantol-btn-secondary {
    background: #fff;
    color: #1d2327;
    border: 1px solid #dcdcde;
    margin-bottom: 10px;
}

.clantol-btn-secondary:hover {
    background: #f6f7f7;
    border-color: #c3c4c7;
}

.clantol-btn:disabled,
.clantol-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #9ca3af !important;
    pointer-events: none;
}

.clantol-btn-disabled:hover {
    background: #9ca3af !important;
    transform: none !important;
}
.clantol-btn-create-password {
    margin-top: 15px;
}

/* ============================================
   Password Strength Meter
   ============================================ */

.clantol-password-strength-wrapper {
    margin-top: 10px;
}

.clantol-password-strength {
    height: 4px;
    border-radius: 2px;
    background: #dcdcde;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.clantol-password-strength.short {
    width: 20%;
    background: #dc3232;
}

.clantol-password-strength.bad {
    width: 40%;
    background: #f56e28;
}

.clantol-password-strength.good {
    width: 60%;
    background: #ffb900;
}

.clantol-password-strength.strong {
    width: 100%;
    background: #46b450;
}

.clantol-password-hint {
    font-size: 12px;
    color: #646970;
    margin-top: 20px;
}

/* ============================================
   Email Display (Step 2 e 3)
   ============================================ */

.clantol-email-display {
    position: relative;
    padding: 12px 80px 12px 16px;
    background: #f6f7f7;
    border-radius: 8px;
    margin-bottom: 20px;
}

.clantol-email-value {
    font-size: 14px;
    color: #1d2327;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}

.clantol-btn-back {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #2271b1;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.clantol-btn-back:hover {
    color: #135e96;
    text-decoration: underline;
}

.clantol-btn-forgot-password {
    background: none;
    border: none;
    color: #2271b1;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.clantol-btn-forgot-password:hover {
    color: #135e96;
    text-decoration: underline;
}

/* ============================================
   Register Message
   ============================================ */

.clantol-register-message {
    text-align: center;
    font-size: 16px;
    color: #1d2327;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ============================================
   Password Create Wrapper (transizione)
   ============================================ */

.clantol-password-create-wrapper {
    animation: slideDown 0.3s ease-in-out;
    margin-top: 15px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

/* ============================================
   Separator
   ============================================ */

.clantol-form-separator {
    position: relative;
    text-align: center;
    margin: 25px 0;
}

.clantol-form-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #dcdcde;
}

.clantol-form-separator span {
    position: relative;
    background: #fff;
    padding: 0 15px;
    font-size: 13px;
    color: #646970;
}

/* ============================================
   OAuth Buttons
   ============================================ */

.clantol-oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clantol-btn-oauth {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #dcdcde;
    border-radius: 20px;
    background: #fff;
    color: #1d2327;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.clantol-btn-oauth:hover {
    background: #f6f7f7;
    border-color: #c3c4c7;
}

.clantol-btn-oauth svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Stile Google */
.clantol-oauth-google {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #000000 !important;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.25px;
    padding: 10px 24px;
}

.clantol-oauth-google:hover {
    background: #1a1a1a !important;
    border-color: #1a1a1a !important;
}

/* Stile Apple Human Interface Guidelines */
.clantol-oauth-apple {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #000000 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: -0.01em;
    padding: 10px 24px;
}

.clantol-oauth-apple:hover {
    background: #1a1a1a !important;
    border-color: #1a1a1a !important;
}

/* ============================================
   Footer Links
   ============================================ */

.clantol-form-footer {
    text-align: center;
    margin-top: 20px;
}

.clantol-link {
    color: #2271b1;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.clantol-link:hover {
    color: #135e96;
    text-decoration: underline;
}

/* ============================================
   Loading Overlay
   ============================================ */

.clantol-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.clantol-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   Messages
   ============================================ */

.clantol-form-messages {
    margin-top: 15px;
}

.clantol-message {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.clantol-message-success {
    background: #d7f0d7;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.clantol-message-error {
    background: #fdecea;
    color: #c62828;
    border: 1px solid #f44336;
}

.clantol-message-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #2196f3;
}

/* ============================================
   Already Logged In Message
   ============================================ */

.clantol-login-form-message {
    text-align: center;
    padding: 20px;
    background: #f6f7f7;
    border-radius: 8px;
    font-size: 16px;
    color: #1d2327;
}

.clantol-login-form-message a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.clantol-login-form-message a:hover {
    text-decoration: underline;
}

/* ============================================
   CAPTCHA Integration
   ============================================ */

.clantol-captcha-wrapper {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.clantol-login-form .clantol-turnstile,
.clantol-login-form .clantol-recaptcha,
.clantol-login-form .clantol-hcaptcha,
.clantol-login-form .cf-turnstile,
.clantol-login-form .g-recaptcha,
.clantol-login-form .h-captcha {
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

/* ============================================
   Disclaimer Privacy
   ============================================ */

.clantol-disclaimer {
    margin: 15px 0;
    padding: 12px 16px;
    background: #f6f7f7;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.6;
    color: #646970;
    text-align: center;
}

.clantol-disclaimer a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.clantol-disclaimer a:hover {
    text-decoration: underline;
}

.clantol-disclaimer strong {
    color: #1d2327;
}

/* ============================================
   Responsive
   ============================================ */

@media screen and (max-width: 480px) {
    .clantol-login-form-wrapper {
        padding: 10px;
    }
    
    .clantol-login-form {
        padding: 20px;
    }
    
    .clantol-input {
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    .clantol-btn {
        padding: 14px 20px;
    }
}

/* ============================================
   Compatibilità Page Builder
   ============================================ */

/* Bricks */
.brxe-div .clantol-login-form-wrapper,
.brxe-section .clantol-login-form-wrapper {
    max-width: 100%;
}

/* Elementor */
.elementor-widget-shortcode .clantol-login-form-wrapper {
    max-width: 100%;
}

/* Divi */
.et_pb_module .clantol-login-form-wrapper {
    max-width: 100%;
}

/* ============================================
   Accessibility
   ============================================ */

.clantol-btn:focus,
.clantol-input:focus,
.clantol-btn-back:focus,
.clantol-btn-submit-arrow:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .clantol-input,
    .clantol-btn {
        border-width: 2px;
    }
}

/* ============================================
   Step 2FA
   ============================================ */

.clantol-2fa-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    text-align: center;
}

.clantol-2fa-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px 0;
    text-align: center;
}

.clantol-2fa-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.clantol-btn-2fa-method {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.clantol-btn-2fa-method:hover {
    border-color: #2563eb;
    background: #f8faff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.clantol-btn-2fa-method svg {
    flex-shrink: 0;
    color: #2563eb;
}

.clantol-2fa-code-input {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.clantol-btn-verify-2fa {
    width: 100%;
    padding: 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clantol-btn-verify-2fa:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.clantol-btn-back-methods {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clantol-btn-back-methods:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* ============================================
   Step Setup 2FA (Obbligatorio)
   ============================================ */

.clantol-mandatory-notice {
    margin-bottom: 20px;
}

.clantol-mandatory-notice p {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin: 0;
}

.clantol-mandatory-notice p.warning {
    background-color: #fff8e1;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.clantol-mandatory-notice p.error {
    background-color: #fdecea;
    border-left: 4px solid #dc3232;
    color: #c62828;
}

.clantol-setup-methods-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.clantol-setup-action-container {
    background: #f8faff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e7ff;
    margin-bottom: 20px;
}

.clantol-qr-setup {
    text-align: center;
    margin-bottom: 20px;
}

.clantol-qr-setup img {
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
}

.clantol-setup-footer {
    margin-top: 20px;
    text-align: center;
}

.clantol-btn-skip-setup {
    background: none;
    border: none;
    color: #646970;
    text-decoration: underline;
    font-size: 13px;
    cursor: pointer;
}

.clantol-btn-skip-setup:hover {
    color: #1d2327;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .clantol-form-step,
    .clantol-message,
    .clantol-password-create-wrapper {
        animation: none;
    }
    
    .clantol-btn,
    .clantol-input,
    .clantol-btn-submit-arrow,
    .clantol-btn-2fa-method,
    .clantol-btn-verify-2fa {
        transition: none;
    }
}
