/* ==========================================================
   PACO-BOT LOGIN - ASISTENTE DE ACCESO
   Compatible con paco_bot_login.php
   ========================================================== */

:root {
    --paco-primary: #0b5cab;
    --paco-primary-dark: #173059;
    --paco-primary-soft: #eaf4ff;
    --paco-accent: #00aaff;
    --paco-success: #18a957;
    --paco-text: #172033;
    --paco-muted: #6b7280;
    --paco-border: rgba(15, 23, 42, 0.10);
    --paco-white: #ffffff;
    --paco-shadow: 0 24px 70px rgba(13, 35, 67, 0.24);
}

/* Contenedor flotante */
.paco-login {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: "Segoe UI", Inter, Arial, sans-serif;
    color: var(--paco-text);
}

/* Botón flotante */
.paco-login-fab {
    position: relative;
    width: 68px;
    height: 68px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0b5cab 0%, #173059 100%);
    box-shadow: 0 14px 32px rgba(11, 92, 171, 0.36);
    transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
    isolation: isolate;
}

.paco-login-fab:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 18px 38px rgba(11, 92, 171, 0.42);
    filter: brightness(1.05);
}

.paco-login-fab:active {
    transform: scale(.97);
}

.paco-login-fab:focus-visible,
.paco-login-close:focus-visible,
.paco-login-quick-actions button:focus-visible,
.paco-login-back:focus-visible,
.paco-login-primary:focus-visible {
    outline: 3px solid rgba(0, 170, 255, .32);
    outline-offset: 3px;
}

.paco-login-fab-icon {
    position: relative;
    z-index: 2;
    font-size: 31px;
    line-height: 1;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.14));
}

.paco-login-fab-pulse {
    position: absolute;
    inset: -5px;
    border: 2px solid rgba(0, 170, 255, .42);
    border-radius: 50%;
    z-index: 1;
    animation: pacoPulse 2.1s infinite;
}

@keyframes pacoPulse {
    0%   { transform: scale(.88); opacity: .8; }
    70%  { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(1.25); opacity: 0; }
}

/* Panel */
.paco-login-panel {
    position: absolute;
    right: 0;
    bottom: 86px;
    width: min(390px, calc(100vw - 32px));
    max-height: min(620px, calc(100vh - 130px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(255, 255, 255, .98);
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 24px;
    box-shadow: var(--paco-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    opacity: 0;
    visibility: hidden;
    transform: translateY(18px) scale(.96);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.paco-login-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.paco-login-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 18px 17px;
    background: linear-gradient(135deg, #173059 0%, #0b5cab 62%, #087ec0 100%);
    color: #fff;
}

.paco-login-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 18px;
    background: linear-gradient(to bottom, rgba(11,92,171,.12), transparent);
    pointer-events: none;
}

.paco-login-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.paco-login-avatar {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    font-size: 24px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}

.paco-login-brand > div:last-child {
    min-width: 0;
}

.paco-login-brand strong {
    display: block;
    margin: 0;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -.15px;
}

.paco-login-brand small {
    display: block;
    margin-top: 3px;
    color: rgba(255,255,255,.78);
    font-size: 12px;
    line-height: 1.2;
}

.paco-login-close {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: 25px;
    line-height: 1;
    transition: background .18s ease, transform .18s ease;
}

.paco-login-close:hover {
    background: rgba(255,255,255,.22);
    transform: rotate(3deg);
}

/* Cuerpo */
.paco-login-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background:
        radial-gradient(circle at 100% 0%, rgba(0,170,255,.07), transparent 36%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    scrollbar-width: thin;
    scrollbar-color: #c9d7e8 transparent;
}

.paco-login-body::-webkit-scrollbar {
    width: 6px;
}

.paco-login-body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #c9d7e8;
}

/* Mensaje del bot */
.paco-login-message {
    position: relative;
    margin: 0 0 18px;
    padding: 15px 16px;
    border-radius: 18px 18px 18px 6px;
    font-size: 14px;
    line-height: 1.58;
}

.paco-login-message.bot {
    background: #fff;
    border: 1px solid var(--paco-border);
    box-shadow: 0 10px 28px rgba(25, 62, 105, .08);
}

.paco-login-message.bot::before {
    content: "P";
    position: absolute;
    left: -10px;
    top: 15px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #0b5cab, #173059);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 5px 12px rgba(11,92,171,.22);
}

.paco-login-message strong {
    color: #123766;
}

.paco-login-message ol {
    margin: 12px 0 2px 20px;
    padding: 0;
}

.paco-login-message li {
    margin: 8px 0;
    padding-left: 3px;
}

/* Acciones principales */
.paco-login-quick-actions {
    display: grid;
    gap: 11px;
}

.paco-login-quick-actions button {
    width: 100%;
    min-height: 54px;
    padding: 12px 14px;
    border: 1px solid rgba(11,92,171,.11);
    border-radius: 15px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    font-size: 13.5px;
    font-weight: 650;
    color: #173059;
    background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
    box-shadow: 0 7px 18px rgba(25, 62, 105, .06);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.paco-login-quick-actions button:hover {
    transform: translateY(-2px);
    border-color: rgba(0,170,255,.45);
    background: var(--paco-primary-soft);
    box-shadow: 0 10px 24px rgba(11,92,171,.12);
}

/* Botón/enlace primario */
.paco-login-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    margin-top: 14px;
    padding: 11px 15px;
    box-sizing: border-box;
    border-radius: 13px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 13.5px;
    background: linear-gradient(135deg, #0b5cab 0%, #087ec0 100%);
    box-shadow: 0 9px 22px rgba(11,92,171,.22);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.paco-login-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(11,92,171,.3);
    filter: brightness(1.04);
}

.paco-login-back {
    width: 100%;
    min-height: 43px;
    margin-top: 4px;
    border: 1px solid rgba(23,48,89,.13);
    border-radius: 13px;
    cursor: pointer;
    color: #40536e;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    background: #fff;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.paco-login-back:hover {
    background: #f2f7fc;
    color: #173059;
    border-color: rgba(11,92,171,.25);
}

/* Footer */
.paco-login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    box-sizing: border-box;
    border-top: 1px solid rgba(15,23,42,.07);
    background: #f8fafc;
    color: #64748b;
    text-align: center;
    font-size: 11.5px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
    .paco-login {
        right: 14px;
        bottom: 14px;
    }

    .paco-login-fab {
        width: 60px;
        height: 60px;
    }

    .paco-login-fab-icon {
        font-size: 27px;
    }

    .paco-login-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 86px;
        width: auto;
        max-height: calc(100vh - 110px);
        border-radius: 20px;
    }

    .paco-login-header {
        padding: 16px;
    }

    .paco-login-body {
        padding: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .paco-login-fab,
    .paco-login-panel,
    .paco-login-close,
    .paco-login-quick-actions button,
    .paco-login-primary,
    .paco-login-back,
    .paco-login-fab-pulse {
        animation: none !important;
        transition: none !important;
    }
}


/* ===== Mascota dinámica Paco-Bot ===== */
.paco-login-fab { overflow: visible; padding: 0; }
.paco-login-fab-img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
    position: relative; z-index: 2; border: 2px solid rgba(255,255,255,.9);
}
.paco-login-avatar { overflow: hidden; padding: 0; }
.paco-login-avatar img { width:100%; height:100%; object-fit:cover; border-radius:inherit; }
.paco-login-quick-actions button { display:flex; align-items:center; gap:12px; }
.paco-login-quick-actions button > span:last-child { display:flex; flex-direction:column; gap:3px; }
.paco-login-quick-actions button small { font-weight:500; color:#708198; font-size:11.5px; }
.paco-action-icon { font-size:23px; flex:0 0 32px; text-align:center; }
.paco-login-thinking {
    display:flex; align-items:center; gap:14px; padding:15px;
    border:1px solid rgba(11,92,171,.12); border-radius:18px;
    background:#fff; box-shadow:0 10px 28px rgba(25,62,105,.08);
}
.paco-login-thinking img { width:58px; height:58px; border-radius:50%; object-fit:cover; }
.paco-login-thinking strong { display:block; font-size:13px; color:#173059; }
.paco-dots { display:flex; gap:5px; margin-top:9px; }
.paco-dots i {
    width:7px; height:7px; border-radius:50%; background:#00aaff;
    animation:pacoDot 1.1s infinite ease-in-out;
}
.paco-dots i:nth-child(2){animation-delay:.15s}.paco-dots i:nth-child(3){animation-delay:.3s}
@keyframes pacoDot { 0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-5px);opacity:1} }
