/* ═══════════════════════════════════════════════════════════
   PGH SHOUTBOX — stream.css companion
═══════════════════════════════════════════════════════════ */

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

.pgh-sb-wrap {
    --sb-bg:       #ffffff;
    --sb-hdr:      #1a1a1a;
    --sb-accent:   #c0392b;
    --sb-border:   #eeeeee;
    --sb-muted:    #888888;
    --sb-text:     #1a1a1a;
    --sb-input-bg: #f7f7f7;
    --sb-radius:   10px;

    font-family: 'DM Sans', sans-serif;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    background: var(--sb-bg);
    max-width: 100%;
    width: 100%;
}

/* ── HEADER ────────────────────────────────────────────── */
.pgh-sb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sb-hdr);
    padding: 10px 14px;
}

.pgh-sb-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pgh-sb-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: pgh-sb-pulse 1.5s infinite;
    flex-shrink: 0;
}

@keyframes pgh-sb-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

.pgh-sb-title {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.pgh-sb-online {
    font-size: 11px;
    color: #888;
    background: rgba(255,255,255,.08);
    padding: 2px 8px;
    border-radius: 20px;
}

.pgh-sb-header-right {
    display: flex;
    gap: 6px;
}

.pgh-sb-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #888;
    padding: 4px 6px;
    border-radius: 5px;
    line-height: 1;
    transition: background .15s, color .15s;
}

.pgh-sb-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.pgh-sb-icon-btn.active { color: #22c55e; }
.pgh-sb-profile-btn { padding: 3px 6px; display: flex; align-items: center; text-decoration: none; }

/* ── PINNED ────────────────────────────────────────────── */
.pgh-sb-pinned {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    padding: 7px 12px;
    font-size: 12px;
    color: #92400e;
}

.pgh-sb-pin-icon { flex-shrink: 0; }

.pgh-sb-unpin-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: #92400e;
    font-size: 12px;
    opacity: .6;
    padding: 0 4px;
}

.pgh-sb-unpin-btn:hover { opacity: 1; }

/* ── FEED ──────────────────────────────────────────────── */
.pgh-sb-feed {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px 0;
    scroll-behavior: smooth;
}

.pgh-sb-feed::-webkit-scrollbar { width: 4px; }
.pgh-sb-feed::-webkit-scrollbar-track { background: transparent; }
.pgh-sb-feed::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.pgh-sb-loading {
    text-align: center;
    padding: 24px;
    color: var(--sb-muted);
    font-size: 13px;
}

/* ── MESSAGE ───────────────────────────────────────────── */
.pgh-sb-msg {
    display: flex;
    gap: 8px;
    padding: 7px 12px;
    transition: background .15s;
    position: relative;
}

.pgh-sb-msg:hover { background: #fafafa; }
.pgh-sb-msg.pgh-sb-new { animation: pgh-sb-slide-in .25s ease; }

@keyframes pgh-sb-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.pgh-sb-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    margin-top: 2px;
}

.pgh-sb-msg-avatar-guest {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    flex-shrink: 0;
    margin-top: 2px;
}

.pgh-sb-msg-content { flex: 1; min-width: 0; }

.pgh-sb-msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.pgh-sb-msg-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--sb-text);
}

.pgh-sb-msg-name.pgh-sb-mod-name { color: var(--sb-accent); }

.pgh-sb-platform-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.pgh-sb-platform-PC     { background: #dbeafe; color: #1d4ed8; }
.pgh-sb-platform-PS5    { background: #ede9fe; color: #6d28d9; }
.pgh-sb-platform-Xbox   { background: #dcfce7; color: #166534; }
.pgh-sb-platform-Mobile { background: #fef3c7; color: #92400e; }
.pgh-sb-platform-Switch { background: #fee2e2; color: #991b1b; }

.pgh-sb-game-tag {
    font-size: 10px;
    color: var(--sb-accent);
    font-weight: 600;
}

.pgh-sb-lfg-badge {
    font-size: 10px;
    font-weight: 700;
    background: var(--sb-accent);
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
    letter-spacing: .3px;
}

.pgh-sb-msg-time {
    font-size: 10px;
    color: var(--sb-muted);
    margin-left: auto;
    white-space: nowrap;
}

.pgh-sb-msg-text {
    font-size: 13px;
    color: var(--sb-text);
    line-height: 1.45;
    word-break: break-word;
}

/* @mention highlight */
.pgh-sb-mention {
    color: var(--sb-accent);
    font-weight: 600;
}

/* ── LINK PREVIEWS ─────────────────────────────────────── */
.pgh-sb-preview {
    margin-top: 7px;
    border: 1px solid var(--sb-border);
    border-radius: 7px;
    overflow: hidden;
    background: #f9f9f9;
    max-width: 280px;
}

.pgh-sb-preview a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.pgh-sb-preview-img {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    display: block;
}

.pgh-sb-preview-body {
    padding: 8px 10px;
}

.pgh-sb-preview-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--sb-text);
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pgh-sb-preview-desc {
    font-size: 11px;
    color: var(--sb-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pgh-sb-preview-type {
    font-size: 10px;
    color: var(--sb-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 4px;
}

/* YouTube play button overlay */
.pgh-sb-yt-wrap {
    position: relative;
    cursor: pointer;
}

.pgh-sb-yt-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    pointer-events: none;
}

/* ── REACTIONS ─────────────────────────────────────────── */
.pgh-sb-reactions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.pgh-sb-reaction-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
    color: var(--sb-text);
}

.pgh-sb-reaction-btn:hover { background: #e5e7eb; }
.pgh-sb-reaction-btn.pgh-sb-reacted {
    background: #fee2e2;
    border-color: #fca5a5;
    color: var(--sb-accent);
}

.pgh-sb-reaction-count {
    font-weight: 700;
    font-size: 11px;
}

/* Add reaction button */
.pgh-sb-add-reaction {
    background: transparent;
    border: 1px dashed #ddd;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    color: var(--sb-muted);
    transition: all .15s;
}

.pgh-sb-add-reaction:hover { border-color: var(--sb-accent); color: var(--sb-accent); }

/* Reaction picker */
.pgh-sb-reaction-picker {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: 8px;
    padding: 6px 10px;
    display: flex;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 100;
    white-space: nowrap;
}

.pgh-sb-reaction-picker button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background .1s;
}

.pgh-sb-reaction-picker button:hover { background: #f3f4f6; }

/* ── MOD ACTIONS ───────────────────────────────────────── */
.pgh-sb-msg-actions {
    display: none;
    gap: 6px;
    margin-top: 4px;
}

.pgh-sb-msg:hover .pgh-sb-msg-actions { display: flex; }

.pgh-sb-action-sm {
    font-size: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sb-muted);
    padding: 1px 5px;
    border-radius: 4px;
    transition: all .15s;
}

.pgh-sb-action-sm:hover { background: #f3f4f6; color: var(--sb-text); }
.pgh-sb-action-sm.pgh-sb-delete:hover { background: #fee2e2; color: var(--sb-accent); }

/* ── INPUT AREA ────────────────────────────────────────── */
.pgh-sb-input-area {
    border-top: 1px solid var(--sb-border);
    padding: 10px 12px;
    background: #fafafa;
}

.pgh-sb-guest-row { margin-bottom: 8px; }

.pgh-sb-name-input,
.pgh-sb-game-input,
.pgh-sb-link-input,
.pgh-sb-msg-input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: var(--sb-text);
    background: #fff;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
}

.pgh-sb-name-input:focus,
.pgh-sb-game-input:focus,
.pgh-sb-link-input:focus,
.pgh-sb-msg-input:focus {
    border-color: var(--sb-accent);
}

.pgh-sb-meta-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.pgh-sb-select {
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    padding: 7px 8px;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    color: var(--sb-text);
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
}

.pgh-sb-select:focus { border-color: var(--sb-accent); }

.pgh-sb-msg-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pgh-sb-my-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.pgh-sb-char-count {
    font-size: 11px;
    color: var(--sb-muted);
    flex-shrink: 0;
    min-width: 28px;
    text-align: right;
}

.pgh-sb-char-count.pgh-sb-char-warn { color: #f59e0b; }
.pgh-sb-char-count.pgh-sb-char-over { color: var(--sb-accent); }

.pgh-sb-link-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.pgh-sb-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pgh-sb-actions-left { display: flex; gap: 6px; }

.pgh-sb-action-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--sb-text);
    transition: all .15s;
}

.pgh-sb-action-btn:hover { background: #e5e7eb; }
.pgh-sb-action-btn.active { background: #fee2e2; border-color: #fca5a5; color: var(--sb-accent); }

.pgh-sb-send-btn {
    background: var(--sb-accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 7px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: background .15s;
}

.pgh-sb-send-btn:hover { background: #a93226; }
.pgh-sb-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── COLLAPSED STATE ───────────────────────────────────── */
.pgh-sb-wrap.pgh-sb-collapsed .pgh-sb-body,
.pgh-sb-wrap.pgh-sb-collapsed .pgh-sb-input-area {
    display: none;
}

/* ── TOAST ─────────────────────────────────────────────── */
.pgh-sb-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    font-size: 13px;
    padding: 8px 18px;
    border-radius: 20px;
    z-index: 999999;
    animation: pgh-sb-toast-in .2s ease;
}

@keyframes pgh-sb-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 480px) {
    .pgh-sb-meta-row {
        grid-template-columns: 1fr;
    }
    .pgh-sb-feed { max-height: 260px; }
}


/* ══════════════════════════════════════════════════════════
   WHO'S ONLINE STRIP
══════════════════════════════════════════════════════════ */
.pgh-sb-whos-online {
    background: #fafafa;
    border-top: 1px solid var(--sb-border);
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--sb-muted);
}

.pgh-sb-wo-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    align-items: flex-start;
}

.pgh-sb-wo-section {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pgh-sb-wo-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}
.pgh-sb-wo-icon-member { background: #16a34a; }
.pgh-sb-wo-icon-guest  { background: #9ca3af; }
.pgh-sb-wo-icon-bot    { background: #6b7280; border: 1px dashed #374151; }

.pgh-sb-wo-label {
    font-weight: 600;
    color: #4a4a4a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pgh-sb-wo-count {
    font-weight: 600;
    color: var(--sb-text);
}

.pgh-sb-wo-list {
    color: var(--sb-text);
}

.pgh-sb-wo-user {
    text-decoration: none;
    font-weight: 600;
    color: var(--sb-text);
    transition: color 0.15s;
}
.pgh-sb-wo-user:hover { color: var(--sb-accent); }

.pgh-sb-wo-admin {
    color: var(--sb-accent);
}
.pgh-sb-wo-admin::after {
    content: ' ★';
    font-size: 10px;
    color: var(--sb-accent);
}

.pgh-sb-wo-mod {
    color: #16a34a;
}
.pgh-sb-wo-mod::after {
    content: ' ◆';
    font-size: 10px;
    color: #16a34a;
}

.pgh-sb-wo-member {
    color: var(--sb-text);
}

.pgh-sb-wo-botname {
    font-style: italic;
    color: #6b7280;
    font-size: 11px;
}

.pgh-sb-wo-empty {
    color: var(--sb-muted);
    font-style: italic;
    font-size: 11px;
}

/* ══════════════════════════════════════════════════════════
   FULLSCREEN BUTTON + FULLSCREEN MODE
══════════════════════════════════════════════════════════ */
.pgh-sb-fs-btn {
    font-size: 16px;
}

/* ══════════════════════════════════════════════════════════
   FULLSCREEN MODE — bulletproof overlay
══════════════════════════════════════════════════════════ */
html.pgh-sb-body-fs,
body.pgh-sb-body-fs {
    overflow: hidden !important;
    height: 100% !important;
    position: relative !important;
}

/* Backdrop dims everything behind the fullscreen shoutbox */
.pgh-sb-fs-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999998;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.pgh-sb-body-fs .pgh-sb-fs-backdrop {
    display: block;
}

/* Floating exit button — guaranteed visible, top-right of viewport */
.pgh-sb-fs-exit {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000001;
    line-height: 1;
    padding: 0;
    transition: all 0.2s;
    align-items: center;
    justify-content: center;
}
.pgh-sb-body-fs .pgh-sb-fs-exit {
    display: flex !important;
}
.admin-bar.pgh-sb-body-fs .pgh-sb-fs-exit {
    top: 48px;
}
.pgh-sb-fs-exit:hover {
    background: var(--sb-accent, #c0392b);
    border-color: var(--sb-accent, #c0392b);
    transform: scale(1.05);
}

/* The shoutbox itself in fullscreen mode */
#pgh-shoutbox.pgh-sb-fullscreen,
.pgh-sb-wrap.pgh-sb-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    z-index: 1000000 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--sb-bg, #fff) !important;
    overflow: hidden !important;
}

/* Push down past WP admin bar if logged in (32px desktop, 46px mobile) */
.admin-bar #pgh-shoutbox.pgh-sb-fullscreen,
.admin-bar .pgh-sb-wrap.pgh-sb-fullscreen {
    top: 32px !important;
    height: calc(100vh - 32px) !important;
    height: calc(100dvh - 32px) !important;
}
@media screen and (max-width: 782px) {
    .admin-bar #pgh-shoutbox.pgh-sb-fullscreen,
    .admin-bar .pgh-sb-wrap.pgh-sb-fullscreen {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
        height: calc(100dvh - 46px) !important;
    }
}

#pgh-shoutbox.pgh-sb-fullscreen .pgh-sb-header,
.pgh-sb-wrap.pgh-sb-fullscreen .pgh-sb-header {
    flex-shrink: 0 !important;
}

#pgh-shoutbox.pgh-sb-fullscreen .pgh-sb-body,
.pgh-sb-wrap.pgh-sb-fullscreen .pgh-sb-body {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
}

#pgh-shoutbox.pgh-sb-fullscreen .pgh-sb-feed,
.pgh-sb-wrap.pgh-sb-fullscreen .pgh-sb-feed {
    flex: 1 1 auto !important;
    max-height: none !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
}

#pgh-shoutbox.pgh-sb-fullscreen .pgh-sb-input-area,
.pgh-sb-wrap.pgh-sb-fullscreen .pgh-sb-input-area {
    flex-shrink: 0 !important;
}

#pgh-shoutbox.pgh-sb-fullscreen .pgh-sb-whos-online,
.pgh-sb-wrap.pgh-sb-fullscreen .pgh-sb-whos-online {
    flex-shrink: 0 !important;
}

/* Override collapsed state if it was set */
#pgh-shoutbox.pgh-sb-fullscreen.pgh-sb-collapsed .pgh-sb-body,
.pgh-sb-wrap.pgh-sb-fullscreen.pgh-sb-collapsed .pgh-sb-body {
    display: flex !important;
}

/* ══════════════════════════════════════════════════════════
   MOBILE — use more of the screen, taller feed
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .pgh-sb-wrap {
        border-radius: 8px;
    }
    .pgh-sb-feed {
        max-height: 50vh;
        min-height: 320px;
    }
    .pgh-sb-header {
        padding: 12px 14px;
    }
    .pgh-sb-whos-online {
        padding: 10px 12px;
        font-size: 11.5px;
    }
    .pgh-sb-wo-inner {
        gap: 6px 14px;
    }
}

@media (max-width: 480px) {
    .pgh-sb-feed {
        max-height: 55vh;
        min-height: 340px;
    }
    /* Hide fullscreen exit hint on smaller screens; button icon speaks for itself */
    .pgh-sb-fs-btn { font-size: 14px; }
    .pgh-sb-icon-btn { padding: 4px 6px; }
    /* In fullscreen on mobile, ensure feed really fills */
    .pgh-sb-wrap.pgh-sb-fullscreen .pgh-sb-feed {
        max-height: none !important;
        min-height: 0 !important;
    }
    .pgh-sb-wo-section { gap: 5px; }
}
