/**
 * Passwordless Login Pro - Frontend
 */

.pwlp-form-wrapper {
    --pwlp-color: #2271b1;
    max-width: 420px;
    margin: 0 auto;
    padding: 32px 28px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

.pwlp-form-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
}

.pwlp-form-description {
    margin: 0 0 24px;
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

.pwlp-field {
    margin-bottom: 16px;
}

.pwlp-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.pwlp-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.pwlp-field input:focus {
    outline: none;
    border-color: var(--pwlp-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pwlp-color) 18%, transparent);
}

.pwlp-code-input {
    text-align: center;
    font-size: 28px !important;
    font-weight: 700;
    letter-spacing: 12px;
    font-family: "Courier New", monospace;
    padding: 14px !important;
}

.pwlp-button {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pwlp-button-primary {
    background: var(--pwlp-color);
    color: #fff;
}

.pwlp-button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--pwlp-color) 35%, transparent);
}

.pwlp-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pwlp-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pwlp-spin 0.7s linear infinite;
}

.pwlp-button.pwlp-loading .pwlp-spinner {
    display: inline-block;
}

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

.pwlp-message {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.pwlp-message.pwlp-success {
    background: #e7f5ec;
    color: #1e6e3a;
    border: 1px solid #b8e0c2;
}

.pwlp-message.pwlp-error {
    background: #fdecec;
    color: #b32424;
    border: 1px solid #f5c6c6;
}

.pwlp-step-info {
    margin: 0 0 16px;
    font-size: 14px;
    color: #555;
    background: #f5f6fa;
    padding: 10px 14px;
    border-radius: 6px;
}

.pwlp-step-info strong {
    color: #1a1a1a;
}

.pwlp-change-email {
    color: var(--pwlp-color);
    text-decoration: none;
    font-size: 13px;
    margin-left: 8px;
}

.pwlp-change-email:hover {
    text-decoration: underline;
}

.pwlp-resend {
    text-align: center;
    margin: 16px 0 0;
    font-size: 13px;
    color: #666;
}

.pwlp-resend-link {
    color: var(--pwlp-color);
    text-decoration: none;
    font-weight: 600;
}

.pwlp-resend-link:hover {
    text-decoration: underline;
}

.pwlp-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.pwlp-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.pwlp-divider span {
    background: #fff;
    padding: 0 16px;
    color: #999;
    font-size: 13px;
    position: relative;
}

.pwlp-traditional-link {
    display: block;
    text-align: center;
    padding: 12px;
    background: #f5f6fa;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.pwlp-traditional-link:hover {
    background: #e8eaf2;
    color: #1a1a1a;
}

.pwlp-already-logged {
    text-align: center;
    padding: 20px;
    background: #f5f6fa;
    border-radius: 8px;
    color: #555;
}

/* Modal popup */
.pwlp-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pwlp-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: pwlp-fade-in 0.2s ease;
}

.pwlp-modal-content {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    animation: pwlp-slide-up 0.3s ease;
}

.pwlp-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    transition: background 0.2s;
}

.pwlp-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

@keyframes pwlp-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pwlp-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pwlp-trigger-button {
    background: var(--pwlp-color, #E91E63);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.pwlp-trigger-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Mobile */
@media (max-width: 480px) {
    .pwlp-form-wrapper {
        padding: 24px 20px;
    }

    .pwlp-code-input {
        font-size: 24px !important;
        letter-spacing: 8px;
    }

    .pwlp-modal {
        padding: 0;
    }

    .pwlp-modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
}

/* ==========================================================================
   INTEGRACIÓN WOOCOMMERCE - Banner compacto (checkout y mi-cuenta)
   ========================================================================== */
.pwlp-wc-banner {
    --pwlp-color: #2271b1;
    --pwlp-green: #16a34a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin: 0 0 16px;
    box-sizing: border-box;
}

.pwlp-wc-banner * {
    box-sizing: border-box;
}

.pwlp-wc-banner-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.pwlp-wc-banner-text strong {
    font-size: 14px;
    color: #0c4a6e;
    line-height: 1.3;
    font-weight: 700;
}

.pwlp-wc-banner-text span {
    font-size: 12px;
    color: #075985;
    line-height: 1.4;
}

.pwlp-wc-banner-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--pwlp-green);
    color: #fff !important;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
    text-decoration: none;
}

.pwlp-wc-banner-btn:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.3);
    color: #fff !important;
}

.pwlp-wc-banner-btn:active {
    transform: translateY(0);
}

.pwlp-wc-banner-btn-icon {
    font-size: 14px;
    line-height: 1;
}

/* Divisor "o usa tu contraseña" (solo en mi-cuenta) */
.pwlp-wc-or-divider {
    text-align: center;
    margin: 18px 0;
    position: relative;
}

.pwlp-wc-or-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid #e5e5e5;
}

.pwlp-wc-or-divider span {
    background: #fff;
    padding: 0 14px;
    color: #888;
    font-size: 11px;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* En checkout, el banner va dentro del form y necesita espacio inferior */
.pwlp-wc-banner-checkout {
    margin-bottom: 18px;
}

/* Responsive */
@media (max-width: 600px) {
    .pwlp-wc-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 10px;
        padding: 14px;
    }

    .pwlp-wc-banner-text {
        align-items: center;
    }

    .pwlp-wc-banner-btn {
        width: 100%;
        padding: 11px 16px;
    }
}

/* ==========================================================================
   POPUP MODAL del formulario passwordless
   ========================================================================== */
.pwlp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.pwlp-popup-overlay.is-open {
    display: flex;
    animation: pwlp-fade-in 0.2s ease;
}

.pwlp-popup-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: pwlp-slide-up 0.25s ease;
    box-sizing: border-box;
}

.pwlp-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s;
    z-index: 2;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwlp-popup-close:hover {
    background: #f0f0f1;
    color: #000;
}

.pwlp-popup-content .pwlp-form-wrapper {
    box-shadow: none;
    margin: 0;
    padding: 28px 24px;
    max-width: 100%;
    border-radius: 12px;
}

@keyframes pwlp-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pwlp-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
