/**
 * MWM Academy – Botón flotante de consulta al tutor
 *
 * @package MWM_Academy
 */

/* ============================================================
   BOTÓN FLOTANTE
   ============================================================ */
.mwm-tutor-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    background: #2271b1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    color: #fff;
    outline: none;
}

.mwm-tutor-btn:hover,
.mwm-tutor-btn:focus {
    background: #135e96;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}

.mwm-tutor-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.mwm-tutor-btn svg {
    width: 26px;
    height: 26px;
    pointer-events: none;
    flex-shrink: 0;
}

/* Pulso sutil al cargar */
@keyframes mwm-tutor-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 113, 177, .5); }
    70%  { box-shadow: 0 0 0 10px rgba(34, 113, 177, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 113, 177, 0); }
}

.mwm-tutor-btn--pulse {
    animation: mwm-tutor-pulse 2s ease-out 1;
}

/* ============================================================
   OVERLAY
   ============================================================ */
.mwm-tutor-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
    animation: mwm-tutor-overlay-in 0.18s ease;
}

.mwm-tutor-overlay.is-open {
    display: block;
}

@keyframes mwm-tutor-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   POPUP
   ============================================================ */
.mwm-tutor-popup {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 10000;
    width: 440px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 130px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .22);
    overflow: hidden;
    flex-direction: column;
    animation: mwm-tutor-popup-in 0.22s cubic-bezier(.34,1.56,.64,1);
}

.mwm-tutor-popup.is-open {
    display: flex;
}

@keyframes mwm-tutor-popup-in {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Cabecera */
.mwm-tutor-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #2271b1;
    color: #fff;
    flex-shrink: 0;
}

.mwm-tutor-popup-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.mwm-tutor-popup-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, .8);
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    margin-left: 12px;
}

.mwm-tutor-popup-close:hover,
.mwm-tutor-popup-close:focus {
    color: #fff;
    background: rgba(255, 255, 255, .15);
    outline: none;
}

.mwm-tutor-popup-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .6);
}

.mwm-tutor-popup-close svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* Cuerpo scrollable */
.mwm-tutor-popup-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.mwm-tutor-popup-intro {
    margin: 0 0 16px;
    font-size: 13px;
    color: #646970;
    line-height: 1.5;
}

/* ============================================================
   FORMULARIO
   ============================================================ */
#mwm-tutor-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mwm-tutor-form-row {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mwm-tutor-form-row--half {
    flex-direction: row;
    gap: 12px;
}

.mwm-tutor-form-row--half .mwm-tutor-field {
    flex: 1;
    min-width: 0;
}

.mwm-tutor-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mwm-tutor-field label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3338;
    line-height: 1.4;
}

.mwm-tutor-required {
    color: #d63638;
    line-height: 1;
    flex-shrink: 0;
}

.mwm-tutor-field input[type="text"],
.mwm-tutor-field input[type="email"],
.mwm-tutor-field textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    color: #2c3338;
    background: #fff;
    border: 1px solid #8c8f94;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.mwm-tutor-field input[type="text"]:focus,
.mwm-tutor-field input[type="email"]:focus,
.mwm-tutor-field textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, .2);
    outline: none;
}

.mwm-tutor-field input.mwm-tutor-field--error,
.mwm-tutor-field textarea.mwm-tutor-field--error {
    border-color: #d63638;
}

.mwm-tutor-field textarea {
    resize: vertical;
    min-height: 100px;
}

/* Feedback */
.mwm-tutor-feedback {
    display: none;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 6px;
    line-height: 1.5;
}

.mwm-tutor-feedback.is-error {
    display: block;
    background: #fcf0f1;
    border: 1px solid #f9b8ba;
    color: #8a1f22;
}

.mwm-tutor-feedback.is-success {
    display: block;
    background: #edfaef;
    border: 1px solid #8ddb9e;
    color: #1a4d22;
}

/* Footer del formulario */
.mwm-tutor-form-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

/* Botón enviar */
.mwm-tutor-submit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: #2271b1;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    line-height: 1.4;
}

.mwm-tutor-submit:hover {
    background: #135e96;
}

.mwm-tutor-submit:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.mwm-tutor-submit:active {
    transform: scale(.98);
}

.mwm-tutor-submit:disabled,
.mwm-tutor-submit.is-loading {
    background: #a7aaad;
    cursor: not-allowed;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .mwm-tutor-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .mwm-tutor-btn svg {
        width: 22px;
        height: 22px;
    }

    .mwm-tutor-popup {
        bottom: 80px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 110px);
        border-radius: 10px;
    }

    .mwm-tutor-form-row--half {
        flex-direction: column;
    }
}
