/* ════════════════════════════════════════════════════════════
   Chat El Rincón del Cornudo — chat.css v1.0.2
   Todas las clases van prefijadas con chatrc- para evitar
   conflictos con los estilos de la web.
════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

#chatrc-root {
    --rc-bg:        #0d0d0f;
    --rc-surface:   #16161a;
    --rc-surface2:  #1e1e26;
    --rc-border:    #2a2a35;
    --rc-accent:    #e8405a;
    --rc-accent2:   #ff6b8a;
    --rc-text:      #f0f0f5;
    --rc-muted:     #66667a;
    --rc-online:    #3ddba3;
    --rc-me:        #e8405a;
    --rc-other:     #1e1e2c;
    --rc-radius:    22px;
    font-family: 'DM Sans', sans-serif;
    box-sizing: border-box;
}

#chatrc-root *, #chatrc-root *::before, #chatrc-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


/* ── OVERRIDE SITE CSS — colores forzados ────────────────────
   Evita que el CSS de la web sobreescriba los colores del chat
────────────────────────────────────────────────────────────── */
#chatrc-popup input,
#chatrc-popup textarea,
#chatrc-popup button {
    color: #f0f0f5 !important;
    -webkit-text-fill-color: #f0f0f5 !important;
    font-family: 'DM Sans', sans-serif !important;
}
#chatrc-popup input::placeholder,
#chatrc-popup textarea::placeholder {
    color: #66667a !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #66667a !important;
}
#chatrc-popup .chatrc-bubble,
#chatrc-popup .chatrc-bubble * {
    color: #f0f0f5 !important;
    -webkit-text-fill-color: #f0f0f5 !important;
}
#chatrc-popup .chatrc-uname,
#chatrc-popup .chatrc-msender,
#chatrc-popup .chatrc-brand,
#chatrc-popup .chatrc-me-name,
#chatrc-popup .chatrc-uname,
#chatrc-popup h2,
#chatrc-popup p {
    color: #f0f0f5 !important;
}
#chatrc-popup .chatrc-usub,
#chatrc-popup .chatrc-btime,
#chatrc-popup .chatrc-muted {
    color: #66667a !important;
}
#chatrc-popup a { color: #ff6b8a !important; }

/* ── HIDDEN HELPER ──────────────────────────────────────── */
#chatrc-root .chatrc-hidden { display: none !important; }

/* ── FAB ─────────────────────────────────────────────────── */
#chatrc-fab {
    position: fixed;
    bottom: 26px;
    right: 26px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8405a, #c0283e);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    box-shadow: 0 8px 32px rgba(232, 64, 90, .55);
    transition: transform .2s ease, box-shadow .2s ease;
    z-index: 99990;
    outline: none;
}
#chatrc-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 14px 44px rgba(232, 64, 90, .65);
}
#chatrc-fab-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #fff;
    color: #e8405a;
    font-size: 11px;
    font-weight: 800;
    min-width: 21px;
    height: 21px;
    border-radius: 11px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    pointer-events: none;
}

/* ── POPUP ───────────────────────────────────────────────── */
#chatrc-popup {
    position: fixed;
    bottom: 100px;
    right: 26px;
    width: 395px;
    /* Altura flexible: máximo 615px pero nunca sobresale por arriba */
    height: min(615px, calc(100vh - 120px));
    max-height: calc(100vh - 120px);
    min-height: 300px;
    background: var(--rc-bg);
    border: 1px solid #2a2a35 !important;
    border-radius: var(--rc-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(0,0,0,.65), 0 0 0 1px rgba(232,64,90,.08);
    z-index: 99991;
    animation: chatrc-popin .28s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes chatrc-popin {
    from { opacity: 0; transform: scale(.84) translateY(18px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);    }
}

/* Pantallas medianas (portátiles con poco alto) */
@media (max-height: 750px) {
    #chatrc-popup {
        bottom: 90px;
        height: calc(100vh - 110px);
    }
}

/* Responsive móvil */
@media (max-width: 480px) {
    #chatrc-popup {
        width: calc(100vw - 16px);
        height: calc(100vh - 110px);
        right: 8px;
        bottom: 90px;
    }
}

/* ── NAME SCREEN ─────────────────────────────────────────── */
.chatrc-name-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 26px;
    background: var(--rc-bg);
    overflow-y: auto;
}
.chatrc-name-screen::-webkit-scrollbar { width: 4px; }
.chatrc-name-screen::-webkit-scrollbar-thumb { background: var(--rc-border); border-radius: 2px; }

.chatrc-logo-big {
    font-size: 48px;
    margin-bottom: 14px;
    filter: drop-shadow(0 4px 16px rgba(232,64,90,.4));
}
.chatrc-name-screen h2 {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 20px;
    color: #f0f0f5 !important;
    text-align: center;
    margin-bottom: 5px;
}
.chatrc-name-screen p {
    font-size: 13px;
    color: #66667a;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 22px;
}
.chatrc-avatar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
    margin-bottom: 20px;
    max-width: 270px;
}
.chatrc-av-opt {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1e1e26 !important;
    border: 2px solid transparent;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, transform .15s, background .15s;
    outline: none;
}
.chatrc-av-opt:hover    { transform: scale(1.12); }
.chatrc-av-opt.chatrc-chosen {
    border-color: #e8405a;
    background: rgba(232,64,90,.12);
}
.chatrc-name-field {
    width: 100%;
    padding: 12px 16px;
    background: #1e1e26 !important;
    border: 1.5px solid #2a2a35 !important;
    border-radius: 12px;
    color: #f0f0f5 !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 15px !important;
    outline: none !important;
    margin-bottom: 12px;
    transition: border-color .15s;
    box-shadow: none !important;
    -webkit-text-fill-color: #f0f0f5 !important;
}
.chatrc-name-field::placeholder { color: #66667a !important; opacity: 1 !important; }
.chatrc-name-field:focus { border-color: rgba(232,64,90,.6) !important; }

.chatrc-enter-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #e8405a, #c0283e);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .15s;
    margin-bottom: 16px;
}
.chatrc-enter-btn:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.chatrc-enter-btn:disabled             { opacity: .38; cursor: not-allowed; transform: none; }

.chatrc-online-pill {
    background: rgba(61,219,163,.1);
    border: 1px solid rgba(61,219,163,.25);
    color: #3ddba3;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chatrc-online-pill::before {
    content: '';
    width: 7px; height: 7px;
    background: var(--rc-online);
    border-radius: 50%;
    animation: chatrc-pulse 1.5s infinite;
}
@keyframes chatrc-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .35; }
}

/* ── HEADER ──────────────────────────────────────────────── */
.chatrc-header {
    padding: 13px 16px 0;
    background: var(--rc-surface);
    border-bottom: 1px solid var(--rc-border);
    flex-shrink: 0;
}
.chatrc-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}
.chatrc-brand {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 15px;
    color: #f0f0f5 !important;
    display: flex;
    align-items: center;
    gap: 7px;
}
.chatrc-brand .chatrc-dot { color: #e8405a; }
.chatrc-me-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1e1e26 !important;
    border: 1px solid #2a2a35 !important;
    border-radius: 20px;
    padding: 3px 10px 3px 5px;
}
.chatrc-me-av   { font-size: 17px; }
.chatrc-me-name { font-size: 12px; font-weight: 500; color: #f0f0f5 !important; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatrc-close {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #1e1e26 !important;
    border: none;
    color: #66667a;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    margin-left: 6px;
    flex-shrink: 0;
    outline: none;
}
.chatrc-close:hover { background: var(--rc-accent); color: #fff; }

/* ── TABS ────────────────────────────────────────────────── */
.chatrc-tabs { display: flex; gap: 2px; }
.chatrc-tab {
    flex: 1;
    padding: 9px 6px;
    background: none;
    border: none;
    color: #66667a;
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    outline: none;
}
.chatrc-tab.chatrc-active { color: #e8405a; border-bottom-color: #e8405a; }
.chatrc-tab:hover:not(.chatrc-active) { color: #f0f0f5 !important; }
.chatrc-tbadge {
    background: var(--rc-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
}

/* ── BODY ────────────────────────────────────────────────── */
.chatrc-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── USERS LIST ──────────────────────────────────────────── */
.chatrc-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px 10px;
}
.chatrc-users-list::-webkit-scrollbar { width: 4px; }
.chatrc-users-list::-webkit-scrollbar-thumb { background: var(--rc-border); border-radius: 2px; }

.chatrc-sect {
    padding: 10px 10px 3px;
    font-size: 10px;
    font-weight: 700;
    color: #66667a;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-family: 'Syne', sans-serif;
}
.chatrc-user-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s;
    outline: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.chatrc-user-row:hover { background: #1e1e26 !important; }

.chatrc-uav {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: #1e1e26 !important;
    display: flex; align-items: center; justify-content: center;
    font-size: 21px;
    flex-shrink: 0;
    position: relative;
}
.chatrc-uav-sm {
    width: 36px; height: 36px;
    font-size: 18px;
}
.chatrc-dot-online {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 10px; height: 10px;
    background: var(--rc-online);
    border-radius: 50%;
    border: 2px solid var(--rc-bg);
}
.chatrc-uinfo { flex: 1; min-width: 0; }
.chatrc-uname {
    font-size: 14px;
    font-weight: 500;
    color: #f0f0f5 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chatrc-usub {
    font-size: 11px;
    color: #66667a;
    margin-top: 1px;
}
.chatrc-unread {
    background: var(--rc-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chatrc-empty-users {
    padding: 30px 16px;
    text-align: center;
    color: #66667a;
    font-size: 13px;
    line-height: 1.6;
}
.chatrc-empty-icon { font-size: 36px; margin-bottom: 8px; }

/* ── CHAT AREA ───────────────────────────────────────────── */
.chatrc-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chatrc-priv-header {
    padding: 10px 14px;
    background: var(--rc-surface);
    border-bottom: 1px solid var(--rc-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.chatrc-back {
    background: none;
    border: none;
    color: #66667a;
    font-size: 20px;
    cursor: pointer;
    transition: color .15s;
    padding: 2px 4px;
    line-height: 1;
    outline: none;
}
.chatrc-back:hover { color: #f0f0f5 !important; }

.chatrc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.chatrc-messages::-webkit-scrollbar { width: 4px; }
.chatrc-messages::-webkit-scrollbar-thumb { background: var(--rc-border); border-radius: 2px; }

.chatrc-msg-row {
    display: flex;
    gap: 7px;
    align-items: flex-end;
    max-width: 83%;
}
.chatrc-msg-row.chatrc-me {
    margin-left: auto;
    flex-direction: row-reverse;
}
.chatrc-mav {
    width: 27px; height: 27px;
    border-radius: 50%;
    background: #1e1e26 !important;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-bottom: 3px;
}
.chatrc-mcol {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chatrc-msender {
    font-size: 10px;
    color: #66667a;
    font-weight: 500;
    padding: 0 4px;
}
.chatrc-msg-row.chatrc-me .chatrc-msender { text-align: right; }

.chatrc-bubble {
    padding: 8px 13px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.45;
    color: #f0f0f5 !important;
    word-break: break-word;
    white-space: pre-wrap;
}
.chatrc-bubble.chatrc-other { background: var(--rc-other); border-bottom-left-radius: 4px; }
.chatrc-bubble.chatrc-me-b  { background: var(--rc-me);    border-bottom-right-radius: 4px; }

.chatrc-bimg {
    max-width: 200px;
    max-height: 240px;
    border-radius: 12px;
    display: block;
    cursor: zoom-in;
    object-fit: cover;
}
.chatrc-btime {
    font-size: 10px;
    color: #66667a;
    padding: 0 4px;
}
.chatrc-msg-row.chatrc-me .chatrc-btime { text-align: right; }

/* Date separator */
.chatrc-date-sep {
    text-align: center;
    font-size: 11px;
    color: #66667a;
    padding: 6px 0;
}

/* Empty state */
.chatrc-empty-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #66667a;
    font-size: 13px;
    gap: 8px;
    padding: 24px;
    text-align: center;
}
.chatrc-empty-chat .chatrc-empty-icon { font-size: 38px; }

/* Typing indicator */
.chatrc-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 13px;
    background: var(--rc-other);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}
.chatrc-td {
    width: 6px; height: 6px;
    background: var(--rc-muted);
    border-radius: 50%;
    animation: chatrc-tdot 1s infinite;
}
.chatrc-td:nth-child(2) { animation-delay: .16s; }
.chatrc-td:nth-child(3) { animation-delay: .32s; }
@keyframes chatrc-tdot {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-5px); }
}

/* ── INPUT AREA ──────────────────────────────────────────── */
.chatrc-input-area {
    padding: 10px 12px;
    background: var(--rc-surface);
    border-top: 1px solid var(--rc-border);
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex-shrink: 0;
}
.chatrc-previews {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.chatrc-prev-wrap { position: relative; width: 50px; height: 50px; }
.chatrc-prev-thumb {
    width: 50px; height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--rc-accent);
    display: block;
}
.chatrc-prev-del {
    position: absolute;
    top: -5px; right: -5px;
    width: 17px; height: 17px;
    background: var(--rc-accent);
    border: none; border-radius: 50%;
    color: #fff; font-size: 9px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    outline: none;
}
.chatrc-input-row { display: flex; gap: 7px; align-items: center; }
.chatrc-photo-btn {
    width: 38px; height: 38px;
    flex-shrink: 0;
    background: #1e1e26 !important;
    border: 1px solid #2a2a35 !important;
    border-radius: 10px;
    color: #66667a;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s, color .15s;
    outline: none;
}
.chatrc-photo-btn:hover { border-color: #e8405a; color: #e8405a; }
.chatrc-photo-btn:disabled { opacity: .4; cursor: not-allowed; }

.chatrc-textarea {
    flex: 1;
    background: #1e1e26 !important;
    border: 1px solid #2a2a35 !important;
    border-radius: 12px;
    padding: 9px 12px;
    color: #f0f0f5 !important;
    -webkit-text-fill-color: #f0f0f5 !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 14px !important;
    outline: none !important;
    resize: none;
    height: 38px;
    max-height: 90px;
    overflow-y: auto;
    line-height: 1.4;
    transition: border-color .15s;
    box-shadow: none !important;
}
.chatrc-textarea::placeholder { color: #66667a !important; opacity: 1 !important; }
.chatrc-textarea:focus { border-color: rgba(232,64,90,.5) !important; }

.chatrc-send-btn {
    width: 38px; height: 38px;
    flex-shrink: 0;
    background: var(--rc-accent);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, transform .15s;
    outline: none;
}
.chatrc-send-btn:hover:not(:disabled) { background: var(--rc-accent2); transform: scale(1.06); }
.chatrc-send-btn:disabled             { opacity: .35; cursor: not-allowed; transform: none; }

/* ── LIGHTBOX ─────────────────────────────────────────────── */
#chatrc-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: chatrc-fade .2s ease;
}
@keyframes chatrc-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
#chatrc-lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 12px;
    box-shadow: 0 0 80px rgba(0,0,0,.8);
}
