/**
 * Xeora Authentication Modals Styles
 * 
 * Stili per i modal di login e registrazione
 * Mobile-first responsive design
 * 
 * @package Xeora
 * @since 2.3.0
 */

/* ==========================================================================
   Modal Base Styles
   ========================================================================== */

.xeora-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.xeora-modal.xeora-modal-active {
    display: flex;
    animation: xeoraFadeIn 0.3s ease forwards;
}

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

.xeora-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.xeora-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: xeoraSlideUp 0.3s ease;
    z-index: 1;
}

.xeora-modal-choice .xeora-modal-content {
    max-width: 800px;
}

@keyframes xeoraSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scrollbar custom */
.xeora-modal-content::-webkit-scrollbar {
    width: 8px;
}

.xeora-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 16px 16px 0;
}

.xeora-modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.xeora-modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==========================================================================
   Modal Header
   ========================================================================== */

.xeora-modal-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.xeora-modal-back {
    position: absolute;
    top: 30px;
    left: 30px;
    background: none;
    border: none;
    font-size: 16px;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.xeora-modal-back:hover {
    color: #111827;
}

.xeora-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.xeora-modal-icon {
    font-size: 28px;
}

.xeora-modal-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.xeora-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.xeora-modal-close:hover {
    background: #e5e7eb;
    color: #111827;
    transform: rotate(90deg);
}

/* ==========================================================================
   Modal Body
   ========================================================================== */

.xeora-modal-body {
    padding: 30px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.xeora-auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.xeora-form-section {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.xeora-form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 4px;
}

.xeora-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xeora-form-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.xeora-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s;
    box-sizing: border-box;
}

.xeora-form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.xeora-form-input::placeholder {
    color: #9ca3af;
}

.xeora-form-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: -4px;
}

.xeora-password-wrapper {
    position: relative;
}

.xeora-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.xeora-password-toggle:hover {
    opacity: 1;
}

.xeora-eye-icon {
    font-size: 18px;
    display: block;
}

/* Form Rows */
.xeora-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.xeora-form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Checkbox */
.xeora-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.xeora-checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Messages */
.xeora-form-messages {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.xeora-form-messages.xeora-message-error {
    display: block;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.xeora-form-messages.xeora-message-success {
    display: block;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.xeora-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.xeora-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.xeora-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.xeora-btn-primary:active {
    transform: translateY(0);
}

.xeora-btn-block {
    width: 100%;
}

.xeora-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.xeora-btn-text {
    display: inline-block;
}

.xeora-btn-loader {
    display: none;
}

.xeora-btn.loading .xeora-btn-text {
    display: none;
}

.xeora-btn.loading .xeora-btn-loader {
    display: inline-block;
}

.xeora-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: xeoraSpin 0.6s linear infinite;
}

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

/* Spinner per testo inline nei pulsanti */
.xeora-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: xeora-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* ==========================================================================
   Choice Cards (Registrazione)
   ========================================================================== */

.xeora-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.xeora-choice-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.xeora-choice-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
    transform: translateY(-4px);
}

.xeora-choice-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.xeora-choice-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.xeora-choice-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

.xeora-choice-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.xeora-feature-tag {
    font-size: 12px;
    color: #374151;
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 6px;
}

.xeora-choice-cta {
    font-size: 14px;
    font-weight: 600;
    color: #3b82f6;
    margin-top: 8px;
}

/* ==========================================================================
   Links & Footer
   ========================================================================== */

.xeora-modal-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.xeora-text-center {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.xeora-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    transition: color 0.2s;
}

.xeora-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.xeora-link-small {
    font-size: 13px;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.xeora-link-small:hover {
    color: #3b82f6;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .xeora-modal {
        padding: 0;
        align-items: flex-end;
    }

    .xeora-modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 24px 24px 0 0;
        width: 100%;
    }

    .xeora-modal-header {
        padding: 24px 20px 16px;
    }

    .xeora-modal-body {
        padding: 20px;
    }

    .xeora-modal-title {
        font-size: 20px;
    }

    .xeora-modal-icon {
        font-size: 24px;
    }

    .xeora-modal-close {
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .xeora-modal-back {
        top: 24px;
        left: 20px;
    }

    .xeora-choice-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .xeora-form-row-2 {
        grid-template-columns: 1fr;
    }

    .xeora-form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .xeora-form-section {
        padding: 16px;
    }

    /* Prevent body scroll when modal open on mobile */
    body.xeora-modal-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .xeora-modal-header {
        padding: 20px 16px 12px;
    }

    .xeora-modal-body {
        padding: 16px;
    }

    .xeora-modal-title {
        font-size: 18px;
    }

    .xeora-form-input {
        padding: 10px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .xeora-btn {
        padding: 12px 20px;
        font-size: 15px;
    }

    .xeora-choice-card {
        padding: 20px;
    }

    .xeora-choice-icon {
        font-size: 40px;
    }

    .xeora-choice-title {
        font-size: 18px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus visible for keyboard navigation */
.xeora-modal-close:focus-visible,
.xeora-btn:focus-visible,
.xeora-link:focus-visible,
.xeora-choice-card:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.xeora-form-input:focus-visible {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .xeora-modal-overlay {
        background: rgba(0, 0, 0, 0.9);
    }

    .xeora-form-input {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .xeora-modal,
    .xeora-modal-content,
    .xeora-btn,
    .xeora-choice-card,
    .xeora-modal-close,
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
