/* ─── YP AI Assistant — Chat CSS v1.0.0 ─────────────────────────────────── */

.ypa-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    border: 1px solid #e0e4f0;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    font-family: inherit;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.ypa-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #334F9D;
    color: #fff;
}

.ypa-header-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ypa-header-info {
    flex: 1;
}

.ypa-header-name {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
}

.ypa-header-status {
    font-size: 11px;
    opacity: .8;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.ypa-status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    animation: ypa-pulse 2s infinite;
}

@keyframes ypa-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

.ypa-clear-btn {
    background: rgba(255,255,255,.15) !important;
    border: none !important;
    border-radius: 8px !important;
    color: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0 !important;
    transition: background .15s;
    flex-shrink: 0;
}

.ypa-clear-btn:hover {
    background: rgba(255,255,255,.28) !important;
}

/* ── Área de mensajes ────────────────────────────────────────────────────── */

.ypa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 260px;
    max-height: 420px;
    background: #f8f9fc;
}

.ypa-messages::-webkit-scrollbar { width: 4px; }
.ypa-messages::-webkit-scrollbar-track { background: transparent; }
.ypa-messages::-webkit-scrollbar-thumb { background: #d0d6e8; border-radius: 4px; }

/* ── Mensajes ────────────────────────────────────────────────────────────── */

.ypa-msg {
    display: flex;
    max-width: 85%;
    animation: ypa-fade-in .2s ease;
}

@keyframes ypa-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ypa-msg--user {
    align-self: flex-end;
}

.ypa-msg--assistant {
    align-self: flex-start;
}

.ypa-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}

.ypa-msg--user .ypa-bubble {
    background: #334F9D;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ypa-msg--assistant .ypa-bubble {
    background: #fff;
    color: #1A1F36;
    border: 1px solid #e0e4f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.ypa-msg--error .ypa-bubble {
    background: #fff5f5;
    border-color: #fca5a5;
    color: #c00;
}

/* ── Indicador de escritura ──────────────────────────────────────────────── */

.ypa-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px !important;
}

.ypa-typing-indicator span {
    width: 7px;
    height: 7px;
    background: #a0aec0;
    border-radius: 50%;
    animation: ypa-bounce .9s infinite;
}

.ypa-typing-indicator span:nth-child(2) { animation-delay: .15s; }
.ypa-typing-indicator span:nth-child(3) { animation-delay: .30s; }

@keyframes ypa-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-5px); }
}

/* ── Input area ──────────────────────────────────────────────────────────── */

.ypa-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e0e4f0;
    background: #fff;
}

.ypa-input {
    flex: 1;
    padding: 9px 12px !important;
    border: 1.5px solid #e0e4f0 !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    color: #1A1F36 !important;
    background: #f8f9fc !important;
    outline: none !important;
    resize: none !important;
    box-shadow: none !important;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color .15s;
    font-family: inherit;
}

.ypa-input:focus {
    border-color: #334F9D !important;
    background: #fff !important;
}

.ypa-input::placeholder {
    color: #a0aec0 !important;
}

.ypa-input:disabled {
    opacity: .6;
}

.ypa-send-btn {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    background: #334F9D !important;
    border: none !important;
    border-radius: 10px !important;
    color: #fff !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    transition: opacity .15s;
}

.ypa-send-btn:hover { opacity: .85; }

.ypa-send-btn--loading {
    opacity: .6;
    pointer-events: none;
}

/* ── Footer note ─────────────────────────────────────────────────────────── */

.ypa-footer-note {
    text-align: center;
    font-size: 10px;
    color: #a0aec0;
    padding: 6px 14px 10px;
    background: #fff;
}

/* ── Login requerido ─────────────────────────────────────────────────────── */

.ypa-login-required {
    padding: 32px !important;
    text-align: center;
    color: #52607A;
}

.ypa-login-msg .dashicons {
    font-size: 32px;
    color: #c8d0e7;
    display: block;
    margin-bottom: 8px;
}

.ypa-login-msg a {
    color: #334F9D;
    font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .ypa-wrap {
        border-radius: 12px;
    }
    .ypa-messages {
        min-height: 220px;
        max-height: 340px;
    }
    .ypa-msg {
        max-width: 92%;
    }
}

/* ── Tarjetas de resultado [MASCOTA] ─────────────────────────────────────── */

.ypa-pet-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin: 6px 0;
    background: #f5f7fe;
    border: 1.5px solid #d0d9f5;
    border-radius: 10px;
    text-decoration: none !important;
    color: inherit !important;
    transition: background .15s, border-color .15s;
    cursor: pointer;
}

.ypa-pet-card:hover {
    background: #eef1fb;
    border-color: #334F9D;
}

.ypa-pet-card-body {
    flex: 1;
    min-width: 0;
}

.ypa-pet-card-name {
    font-weight: 700;
    font-size: 13px;
    color: #1A1F36;
    margin-bottom: 2px;
}

.ypa-pet-card-desc {
    font-size: 12px;
    color: #52607A;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ypa-pet-card-arrow {
    color: #334F9D;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Texto antes/después de las tarjetas */
.ypa-card-intro,
.ypa-card-outro {
    margin: 4px 0 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #1A1F36;
}
