/* ============================================================
   tikspy — estilos compartilhados (dark-only)
   ------------------------------------------------------------
   O layout/tema principal do painel vive no bloco Tailwind do
   index.html. Este arquivo cobre apenas:
   - o overlay OBS (obs.html, que não carrega Tailwind)
   - componentes renderizados em runtime pelo app.js (linhas de
     chat/gift/evento, modais, listas admin) que o bloco Tailwind
     não alcança porque são HTML injetado dinamicamente.
   ============================================================ */

:root {
    color-scheme: dark;
    --bg: #020617;
    --bg-subtle: #0f172a;
    --bg-card: #111827;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #ec4899;
    --accent-hover: #db2777;
    --link: #f472b6;
    --link-hover: #f9a8d4;
    --border: #1e293b;
    --scrollbar-thumb: #334155;
    --overlay: rgba(2, 6, 23, 0.75);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --modal-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

html {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   Overlay OBS
   ------------------------------------------------------------ */
body.obs {
    height: 100%;
    overflow: hidden;
    padding: 10px;
    display: flex;
    flex-direction: column;
    background: transparent;
}

body.obs .eventcontainer {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    word-wrap: break-word;
    height: calc(100vh - 90px);
    scrollbar-width: none;
}

body.obs .eventcontainer::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body.obs .eventcontainer > div {
    margin-top: 5px;
    padding: 4px 8px 5px 8px;
    border-radius: 6px;
    line-height: 1.5;
    font-size: 0.88em;
}

.splitstatetable {
    width: 100%;
    border-collapse: collapse;
}

#stateText {
    margin: 0;
    font-size: 0.85em;
    color: var(--text-secondary);
    font-family: inherit;
    white-space: pre-wrap;
}

#roomStats {
    font-size: 0.85em;
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: right;
}

#roomStats b {
    margin-left: 14px;
    color: var(--text);
}

/* ------------------------------------------------------------
   Links
   ------------------------------------------------------------ */
a {
    color: var(--link);
    transition: color 0.15s;
}

a:hover {
    color: var(--link-hover);
}

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

.usernamelink:hover {
    color: var(--accent);
}

/* ------------------------------------------------------------
   Linhas de chat / gifts / eventos (HTML injetado pelo app.js)
   ------------------------------------------------------------ */
.miniprofilepicture {
    height: 22px;
    width: 22px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
    object-fit: cover;
}

.gifticon {
    height: 48px;
    width: 48px;
    margin-right: 10px;
    border-radius: 8px;
}

.giftcontainer table {
    width: 100%;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.giftcontainer b {
    color: var(--text);
}

/* Linhas de feed (chat / atividade / enigmas) — classe emitida pelo app.js */
@keyframes feedIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.feedrow {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.14);
    line-height: 1.45;
    font-size: 0.95em;
    word-wrap: break-word;
    animation: feedIn 0.18s ease-out;
}

.feedrow:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.28);
}

.feedrow .miniprofilepicture {
    margin-top: 1px;
}

.activityicon {
    height: 26px;
    width: 26px;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 auto;
    margin-top: 1px;
}

/* Compat OBS (obs.html continua usando .eventcontainer > div) */
.chatcontainer > div,
.giftcontainer > div,
.eventcontainer > div {
    padding: 8px 10px;
    border-radius: 8px;
    line-height: 1.5;
    font-size: 0.88em;
    word-wrap: break-word;
}

.chatcontainer > div:hover,
.giftcontainer > div:hover,
.eventcontainer > div:hover {
    background: var(--bg-subtle);
}

.watchlist-hit {
    background: rgba(239, 68, 68, 0.10) !important;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.eventrow {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 0.9em;
    color: var(--text);
    word-break: break-word;
    animation: feedIn 0.18s ease-out;
}

.eventrow:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.3);
}

/* Espaçamento entre linhas em qualquer lista do painel (CSS puro,
   independe do Tailwind — garante separação entre usuários) */
.panellist > div {
    margin-bottom: 6px;
}

.panellist > div:last-child {
    margin-bottom: 0;
}

.eventrowimg {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.eventrowgift {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
    flex: 0 0 auto;
}

.eventrowtext {
    flex: 1;
    min-width: 0;
    white-space: pre-wrap;
}

.eventcomment {
    margin-top: 4px;
    font-style: italic;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ------------------------------------------------------------
   Lives (cards dinâmicos do painel principal)
   ------------------------------------------------------------ */
.livegrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
    gap: 10px;
}

.livecard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 0;
}

.livecardtop {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.livedot {
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    flex-shrink: 0;
    background: #64748b;
}

.livedot.connecting {
    background: #fbbf24;
    animation: pulse 1s ease-in-out infinite;
}

.livedot.active {
    background: #34d399;
    animation: pulse 1s ease-in-out infinite;
}

.livedot.ended {
    background: #64748b;
}

.livedot.error {
    background: #f87171;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.livestreamer {
    font-weight: 700;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.liveremove {
    margin-left: auto;
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1em;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.liveremove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

.livecardstatus {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.livecardactions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.streamerchip {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 7px;
    border-radius: 9999px;
    background: rgba(236, 72, 153, 0.14);
    border: 1px solid rgba(236, 72, 153, 0.35);
    color: #f9a8d4;
    font-size: 0.8em;
    font-weight: 700;
}

/* ------------------------------------------------------------
   Modais (criados dinamicamente pelo app.js)
   ------------------------------------------------------------ */
#profile-modal,
#history-modal,
#simple-json-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#history-modal {
    z-index: 3001;
}

#simple-json-modal {
    z-index: 1200;
    background: rgba(0, 0, 0, 0.55);
}

#profile-modal.active,
#history-modal.active,
#simple-json-modal.active {
    display: flex;
}

#profile-modal-content {
    width: min(440px, 92vw);
    max-height: 88vh;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--modal-shadow);
    position: relative;
}

#profile-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 22px;
    line-height: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

/* ------------------------------------------------------------
   Modal admin
   ------------------------------------------------------------ */
#admin-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 3002;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#admin-modal.active {
    display: flex;
}

#admin-modal-content {
    width: min(880px, 94vw);
    max-height: 88vh;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--modal-shadow);
    position: relative;
}

#admin-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 24px;
    line-height: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

#admin-modal-close:hover {
    color: var(--text);
}

.profile-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(236, 72, 153, 0.35);
    margin: 0 auto;
    display: block;
    background: var(--bg-subtle);
}

.profile-name {
    margin-top: 10px;
    text-align: center;
    font-size: 1.15em;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-nick {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.profile-bio {
    margin-top: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font-size: 0.88em;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.profile-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.profile-cell {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    min-width: 0;
}

.profile-cell .k {
    font-size: 0.66em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 800;
    letter-spacing: 0.6px;
}

.profile-cell .v {
    font-size: 0.85em;
    font-weight: 600;
    word-break: break-all;
    margin-top: 2px;
}

.profile-badges {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badgechip {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badgechip img {
    height: 14px;
    width: 14px;
}

.profile-link {
    margin-top: 12px;
    display: block;
    text-align: center;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9em;
}

.profile-link:hover {
    color: var(--accent-hover);
}

/* Perfil REAL do enigma (revelado pelo userId) */
.profile-real {
    margin-top: 14px;
    border: 1px solid rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.06);
    border-radius: 12px;
    padding: 12px;
}

.profile-real-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.72em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #22c55e;
    margin-bottom: 10px;
}

.profile-real-loading {
    text-align: center;
    font-size: 0.82em;
    color: var(--text-secondary);
    padding: 6px 0;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

.profile-real .profile-avatar {
    width: 72px;
    height: 72px;
    border-color: rgba(34, 197, 94, 0.5);
}

.profile-real .profile-name {
    font-size: 1.05em;
}

.profile-real .realchip {
    background: #22c55e;
    color: #052e16;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.62em;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
}

.verifybadge {
    color: #38bdf8;
    font-size: 0.9em;
    display: inline-flex;
}

.enigmarow-real {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    color: #22c55e;
    font-weight: 700;
    font-size: 0.85em;
}

.enigmarow-real img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

/* ------------------------------------------------------------
   Lista "Na Live" (renderizada pelo app.js)
   ------------------------------------------------------------ */
.viewerrow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.viewerrow:hover {
    background: var(--bg-subtle);
}

.viewerrow.is-enigma {
    background: rgba(244, 63, 94, 0.10);
    outline: 1px solid rgba(244, 63, 94, 0.40);
    box-shadow: 0 0 18px rgba(244, 63, 94, 0.12);
}

.vieweravatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    background: var(--bg-subtle);
}

.viewerinfo {
    flex: 1;
    min-width: 0;
}

.viewername {
    font-weight: 700;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.viewername .viewernametext {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewermeta {
    font-size: 0.76em;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewertime {
    margin-left: auto;
    font-size: 0.7em;
    color: var(--text-secondary);
    white-space: nowrap;
    flex: 0 0 auto;
}

.enigmabadge {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.45);
    color: #fda4af;
    font-size: 0.62em;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 999px;
    letter-spacing: 0.6px;
    flex: 0 0 auto;
}

#simple-json-modal-content,
#history-modal-content {
    width: min(900px, 94vw);
    max-height: 88vh;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--modal-shadow);
}

#history-modal-content {
    width: min(820px, 94vw);
}

/* ------------------------------------------------------------
   Listas do painel admin (renderizadas pelo app.js)
   ------------------------------------------------------------ */
.userrow {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.userrowtop {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.userrowtop input[type="text"] {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 10px;
    font-size: 0.9em;
    outline: none;
    flex: 1;
    min-width: 120px;
}

.userrowactions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* ------------------------------------------------------------
   Scrollbars finas nas caixas de conteúdo (painel)
   ------------------------------------------------------------ */
.chatcontainer,
.giftcontainer,
.eventcontainer {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.chatcontainer::-webkit-scrollbar,
.giftcontainer::-webkit-scrollbar,
.eventcontainer::-webkit-scrollbar {
    width: 6px;
}

.chatcontainer::-webkit-scrollbar-thumb,
.giftcontainer::-webkit-scrollbar-thumb,
.eventcontainer::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
