/* =========================================================================
   core/social.css — THE SOCIAL PANEL. 2026-08-27 social + persistent games.

   The dark-glass right-hand slide-out that replaced the old #chatPanel:
   breadcrumbs, pages, rows, sections, badges, the (light) Create Game
   dialog, the nav's social button + its red dot, and the history hover
   card. The in-game chat's OWN styles (message bubbles, tabs, history
   lines) and THE PUSH block stay in gameManager/MTG/chat.css.

   Everything here is scoped to #socialPanel / #socialButton /
   #createGameOverlay so nothing leaks into the board.
   ========================================================================= */

/* =========================================================================
   1. The nav button (mirrors .menu-button in core/base.css)
   ========================================================================= */
.top-nav {
    justify-content: space-between;
}

.social-button {
    position: relative;
    /* core/social.js keeps --soc-w in step with the open panel's width so
       the toggle slides out from under it and stays clickable (0 on
       mobile — there you tap the backdrop to close). */
    margin-right: var(--soc-w, 0px);
    transition: margin-right 0.24s cubic-bezier(0.32, 0.72, 0.22, 1),
                background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin-top: 35px;
    color: #333;
}

.social-button:hover  { background-color: #f8f8f8; }
.social-button:active { background-color: #f0f0f0; }

/* In-game the nav strip goes transparent (opponent.css) — the social
   button gets the same treatment as the hamburger so the board shows
   through and the icon stays readable on a dark battle station. */
body.game-on.bs-on .social-button {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
}
body.game-on.bs-on .social-button:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* Same look as the old .menu-chat-dot */
.social-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(245, 245, 245, 0.9);
    pointer-events: none;
}
.social-dot.hidden { display: none; }

/* =========================================================================
   2. Panel shell — dark glass, exactly the old #chatPanel treatment
   ========================================================================= */
#socialPanel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    display: flex;
    flex-direction: column;
    background: rgba(17, 20, 26, 0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.35);
    color: #e8eaf0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    z-index: 9500;              /* above the board, below account dialogs (9999) */
    transform: translateX(100%);
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0.22, 1), visibility 0.24s;
    visibility: hidden;
}

body.chat-open #socialPanel {
    transform: translateX(0);
    visibility: visible;
}

#socialBackdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9400;
    opacity: 1;
    transition: opacity 0.24s ease;
}
#socialBackdrop.hidden { opacity: 0; pointer-events: none; }

/* ---------- Resize handle (desktop) ---------- */
#socialResizeHandle {
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
}
#socialResizeHandle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 4px;
    width: 3px;
    height: 44px;
    margin-top: -22px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.18);
    opacity: 0;
    transition: opacity 0.15s ease;
}
#socialResizeHandle:hover::after { opacity: 1; }
body.chat-resizing { cursor: col-resize; user-select: none; }
body.chat-resizing #socialPanel { transition: none; }

/* =========================================================================
   3. Breadcrumb bar (~44px) + close button
   ========================================================================= */
#socialHeader {
    flex: 0 0 auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.soc-crumbs {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 2px;
    min-width: 0;
}
.soc-crumbs::-webkit-scrollbar { display: none; }

.soc-crumb {
    flex: 0 0 auto;
    background: none;
    border: none;
    padding: 4px 5px;
    margin: 0;
    border-radius: 6px;
    color: rgba(232, 234, 240, 0.55);
    font: inherit;
    font-size: 12px;
    line-height: 1;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.soc-crumb:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }

.soc-crumb-home {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
}

.soc-crumb-current {
    color: #e8eaf0;
    font-weight: 600;
    cursor: default;
}
.soc-crumb-current:hover { background: none; }

.soc-crumb-sep {
    flex: 0 0 auto;
    color: rgba(232, 234, 240, 0.25);
    font-size: 10px;
}

#socialCloseBtn {
    flex: 0 0 auto;
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    padding: 7px;
    margin: 0;
    border-radius: 8px;
    color: rgba(232, 234, 240, 0.65);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
#socialCloseBtn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* =========================================================================
   4. The page area
   ========================================================================= */
#socialPage {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 14px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
#socialPage::-webkit-scrollbar { width: 6px; }
#socialPage::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* The chat and DM pages own their own scrolling */
#socialPage.soc-page-gamechat,
#socialPage.soc-page-chat {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

/* ---------- Sections ---------- */
.soc-section { margin-bottom: 18px; }

.soc-section-title {
    margin: 0 0 6px 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(232, 234, 240, 0.42);
}

.soc-hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 12px 0;
}

/* ---------- Rows ---------- */
.soc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 7px 10px;
    border-radius: 9px;
    transition: background 0.15s ease;
}
.soc-row + .soc-row { margin-top: 2px; }
.soc-row-click { cursor: pointer; }
.soc-row-click:hover { background: rgba(255, 255, 255, 0.07); }
.soc-row-click:focus-visible { outline: 2px solid #2f6df6; outline-offset: -2px; }

.soc-row-main { flex: 1 1 auto; min-width: 0; }

.soc-row-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #e8eaf0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soc-row-sub {
    margin-top: 2px;
    font-size: 11.5px;
    color: rgba(232, 234, 240, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soc-row-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.soc-row-date {
    font-size: 10.5px;
    color: rgba(232, 234, 240, 0.35);
}

.soc-chevron {
    color: rgba(232, 234, 240, 0.3);
    font-size: 17px;
    line-height: 1;
}

.soc-current-game {
    background: rgba(47, 109, 246, 0.14);
    border: 1px solid rgba(47, 109, 246, 0.35);
    margin-bottom: 12px;
}
.soc-current-game:hover { background: rgba(47, 109, 246, 0.22); }

/* ---------- Badges ---------- */
.soc-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: rgba(232, 234, 240, 0.75);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.soc-badge-alert { background: #ef4444; color: #fff; }
.soc-badge-win   { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
.soc-badge-soft  { background: rgba(47, 109, 246, 0.22); color: #9dbcff; }

/* ---------- Buttons ---------- */
.soc-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.07);
    color: #e8eaf0;
    border-radius: 7px;
    padding: 8px 14px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.soc-btn:hover  { background: rgba(255, 255, 255, 0.13); }
.soc-btn:active { transform: scale(0.97); }
.soc-btn:disabled { opacity: 0.5; cursor: default; }

.soc-btn-primary {
    background: #2f6df6;
    border-color: #2f6df6;
    color: #fff;
}
.soc-btn-primary:hover { background: #3b7bff; border-color: #3b7bff; }

.soc-btn-danger {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}
.soc-btn-danger:hover { background: rgba(239, 68, 68, 0.28); }

.soc-btn-wide { width: 100%; padding: 10px 14px; }

.soc-btn-mini { padding: 5px 10px; font-size: 11.5px; border-radius: 6px; }

.soc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.soc-home-top { margin-bottom: 4px; }

.soc-link {
    display: inline-block;
    background: none;
    border: none;
    padding: 6px 2px;
    margin: 4px 0;
    color: #7aa5ff;
    font: inherit;
    font-size: 12.5px;
    text-decoration: underline;
    cursor: pointer;
}
.soc-link:hover { color: #a8c4ff; }
.soc-danger-link { color: #fca5a5; }
.soc-danger-link:hover { color: #fecaca; }

.soc-invite-link { display: block; margin-top: 2px; }

/* ---------- Notes / empty / errors ---------- */
.soc-empty,
.soc-loading {
    padding: 14px 10px;
    font-size: 12.5px;
    color: rgba(232, 234, 240, 0.42);
}

.soc-note {
    padding: 8px 10px;
    font-size: 12.5px;
    color: rgba(232, 234, 240, 0.6);
}

.soc-deck-locked {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 7px;
    margin-top: 10px;
}

.soc-error {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 7px;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-size: 12.5px;
    line-height: 1.45;
}

/* ---------- Search / form controls ---------- */
.soc-search { margin-bottom: 10px; }

#socialPanel .soc-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #e8eaf0;
    font: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
#socialPanel .soc-input::placeholder { color: rgba(232, 234, 240, 0.32); }
#socialPanel .soc-input:focus {
    border-color: rgba(47, 109, 246, 0.7);
    background: rgba(255, 255, 255, 0.09);
}
#socialPanel .soc-input-ro { opacity: 0.6; cursor: default; }

#socialPanel .soc-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #e8eaf0;
    font: inherit;
    font-size: 13px;
    outline: none;
}
#socialPanel .soc-select option { color: #111; }
#socialPanel .soc-select-inline { width: auto; min-width: 120px; }

.soc-field { margin-top: 12px; }

.soc-label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(232, 234, 240, 0.42);
}

.soc-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
    font-size: 13px;
    color: #e8eaf0;
    cursor: pointer;
}
#socialPanel .soc-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease;
}
#socialPanel .soc-check input[type="checkbox"]:checked {
    background: #2f6df6;
    border-color: #2f6df6;
}
#socialPanel .soc-check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.soc-form { margin-top: 2px; }

/* ---------- Profile ---------- */
.soc-profile {
    padding: 6px 2px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.soc-profile-name { font-size: 18px; font-weight: 700; }
.soc-profile-sub  { margin-top: 3px; font-size: 12px; color: rgba(232, 234, 240, 0.45); }
.soc-profile-contact { margin-top: 4px; font-size: 12px; color: rgba(232, 234, 240, 0.55); }

/* ---------- Game page ---------- */
.soc-game-head {
    padding: 4px 2px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 12px;
}
.soc-game-title { font-size: 17px; font-weight: 700; line-height: 1.25; }
.soc-game-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.soc-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.soc-tr { display: table-row; }
.soc-td {
    display: table-cell;
    padding: 7px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(232, 234, 240, 0.8);
    vertical-align: middle;
}
.soc-th .soc-td {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(232, 234, 240, 0.38);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}
.soc-td-name { font-weight: 600; color: #e8eaf0; }
.soc-td-deck {
    margin-top: 2px;
    font-size: 10.5px;
    font-weight: 400;
    color: rgba(232, 234, 240, 0.4);
}
.soc-tr-me .soc-td { background: rgba(47, 109, 246, 0.1); }

.soc-game-actions { margin-top: 16px; }

/* ---------- Concession line ---------- */
.soc-concession {
    margin: 6px 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.soc-concession-text {
    display: block;
    font-size: 12.5px;
    line-height: 1.45;
    color: #fecaca;
}
.soc-concession-acts {
    display: flex;
    gap: 8px;
    margin-top: 9px;
}

/* ---------- Login prompt ---------- */
.soc-login {
    text-align: center;
    padding: 40px 16px;
}
.soc-login-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.soc-login-text {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(232, 234, 240, 0.5);
}

/* ---------- Coming Soon ---------- */
.soc-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    text-align: center;
}
.soc-soon-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #7aa5ff, #c39bff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.soc-soon-sub {
    margin-top: 8px;
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(232, 234, 240, 0.35);
}

/* ---------- Direct-message thread ---------- */
.soc-dm-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.soc-dm-scroll::-webkit-scrollbar { width: 6px; }
.soc-dm-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.soc-dm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.soc-dm-form {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    position: static;
    width: auto;
    background: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
}
#socialPanel .soc-dm-form .soc-input { border-radius: 999px; }

.soc-dm-send {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding: 9px 16px;
    border: none;
    border-radius: 999px;
    background: #2f6df6;
    color: #fff;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}
.soc-dm-send:hover  { background: #3b7bff; }
.soc-dm-send:active { transform: scale(0.94); }

/* ---------- Game chat page header ---------- */
.soc-gamechat-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.soc-gamechat-title {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(232, 234, 240, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.soc-gamechat-head .soc-link { margin: 0; white-space: nowrap; }

/* =========================================================================
   5. History hover card (chat.js creates #histHoverImg on the body and
   parks it to the LEFT of the panel)
   ========================================================================= */
#histHoverImg {
    position: fixed;
    width: 220px;
    max-width: 40vw;
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
    z-index: 9600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}
#histHoverImg.visible { opacity: 1; }
#histHoverImg.hidden  { display: none; }

/* =========================================================================
   6. Create Game dialog — LIGHT, reuses .account-overlay/.account-dialog
   ========================================================================= */
.create-game-dialog {
    width: 420px;
    max-width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.create-game-dialog .dialog-title { margin-bottom: 16px; }

/* the dialog is tall — tighten it so the footer fits without scrolling */
.create-game-dialog .form-group  { margin-bottom: 13px; }
.create-game-dialog .deck-actions { margin-top: 16px; }

.create-game-dialog input[type="text"] { font-size: 15px; padding: 9px 12px; }

.create-game-dialog .soc-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 15px;
}
.create-game-dialog .soc-select option { color: #333; }

/* Players segmented control */
.cg-segment {
    display: flex;
    gap: 8px;
}
.cg-seg-btn {
    flex: 1 1 0;
    padding: 8px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #444;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.cg-seg-btn:hover { background: #f5f7fb; }
.cg-seg-btn.selected {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* Visibility radios */
.cg-radios {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cg-radio {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 6px 9px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: background 0.15s ease;
}
.cg-radio:hover { background: #f5f7fb; }
.cg-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}

/* Invite-only friend picker */
.cg-friend-list {
    max-height: 180px;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-top: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
}
.cg-friend {
    padding: 9px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.15s ease;
}
.cg-friend:last-child { border-bottom: none; }
.cg-friend:hover { background: #f1f5f9; }
.cg-friend.selected {
    background: #e0ecff;
    box-shadow: inset 3px 0 0 #2563eb;
}
.cg-friend-name { font-size: 14px; font-weight: 600; color: #1f2937; }
.cg-friend-sub  { margin-top: 2px; font-size: 12px; color: #6b7280; }

.create-game-dialog .soc-empty,
.create-game-dialog .soc-loading { color: #6b7280; }

/* =========================================================================
   7. Responsive — mobile overlays instead of pushing
   ========================================================================= */
@media (max-width: 768px) {
    #socialPanel { width: min(88vw, 400px); }
    #socialResizeHandle { display: none; }
    .soc-crumb { max-width: 96px; }
    .soc-soon-title { font-size: 26px; }
    .create-game-dialog { width: 94vw; padding: 20px 16px; }
    #histHoverImg { display: none; }
}
