/* ============================================================================
 * Isnotgreat — Settings Shell + Command Palette (v56)
 * Visual direction: modern game-app, dark, subtle glow on active states.
 * ==========================================================================*/

/* S6: the shell speaks the app's own design language — same accent (#4cc2ff),
   text, lines, radii and scrollbar as the rest of the app. No Discord blurple. */
:root {
    --ig-bg:            #1f1f1f;   /* app background (#socialPage) */
    --ig-panel:         #26272c;   /* raised surface */
    --ig-panel-hover:   #303239;
    --ig-border:        rgba(255,255,255,.08);   /* --sc-line */
    --ig-border-2:      rgba(255,255,255,.15);   /* --sc-line-2 */
    --ig-text:          #eef2f7;   /* --sc-text */
    --ig-text-muted:    #aeb8c6;   /* --sc-text-2 */
    --ig-text-head:     #f5f8fc;
    --ig-accent:        #4cc2ff;   /* app accent */
    --ig-accent-strong: #2ba6f0;
    --ig-accent-glow:   rgba(76,194,255,.18);
    --ig-success:       #23a55a;
    --ig-warning:       #f0b232;
    --ig-danger:        #f23f43;
}

/* ---------- backdrop + card ---------- */
.ig-backdrop {
    position: fixed; inset: 0; z-index: 99990;
    background: radial-gradient(130% 130% at 50% 0%, rgba(12,14,18,.5) 0%, rgba(0,0,0,.74) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 18px;
    font-family: var(--desk-font, 'Segoe UI Variable Text','Segoe UI', system-ui, sans-serif);
}

/* ---- S6: custom scrollbars — the app's exact scrollbar, so the shell
   (which lives outside #socialPage) can't be spotted as a foreign surface. ---- */
.ig-backdrop { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.ig-backdrop ::-webkit-scrollbar { width: 11px; height: 11px; }
.ig-backdrop ::-webkit-scrollbar-track { background: transparent; }
.ig-backdrop ::-webkit-scrollbar-corner { background: transparent; }
.ig-backdrop ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,.10));
    border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
}
.ig-backdrop ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(76,194,255,.55), rgba(76,194,255,.28));
    background-clip: padding-box;
}
/* rail + palette list: hairline scrollbars (quiet chrome) */
.ig-rail, .ig-pal-list, .ig-role-list { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
.ig-rail::-webkit-scrollbar, .ig-pal-list::-webkit-scrollbar, .ig-role-list::-webkit-scrollbar { width: 7px; height: 7px; }
.ig-rail::-webkit-scrollbar-thumb, .ig-pal-list::-webkit-scrollbar-thumb, .ig-role-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.14); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
}
.ig-rail::-webkit-scrollbar-thumb:hover, .ig-pal-list::-webkit-scrollbar-thumb:hover, .ig-role-list::-webkit-scrollbar-thumb:hover { background: rgba(76,194,255,.4); background-clip: padding-box; }

/* ---- S6: custom line icons (settings-shell.js IC map) ---- */
.ig-ic { flex: none; vertical-align: -2px; }
.ig-shell {
    width: min(920px, 100%);
    height: min(760px, 100%);
    background: var(--ig-bg);
    border: 1px solid var(--ig-border-2);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 24px 80px rgba(0,0,0,.55);
    display: flex; flex-direction: column;
    overflow: hidden;
    color: var(--ig-text);
    font-size: 14px;
    animation: igPop 160ms ease-out;
}
.ig-shell.ig-wide { width: min(1180px, 100%); }
@keyframes igPop { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ig-shell { animation: none; } }

/* redundant <h3> from legacy modal markup */
.ig-title-dup { display: none !important; }

/* ---------- top bar ---------- */
.ig-top {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ig-border);
    background: linear-gradient(180deg, rgba(255,255,255,.025), transparent);
    flex: none;
}
.ig-title { font-size: 16px; font-weight: 600; color: var(--ig-text-head); white-space: nowrap; letter-spacing: .2px; }
.ig-searchwrap {
    flex: 1; display: flex; align-items: center; gap: 8px;
    background: var(--ig-panel);
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--ig-text-muted);
    transition: border-color .12s, box-shadow .12s;
}
.ig-searchwrap:focus-within { border-color: var(--ig-accent); box-shadow: 0 0 0 3px var(--ig-accent-glow); }
.ig-search { flex: 1; background: transparent; border: 0; outline: 0; color: var(--ig-text); font-size: 13.5px; }
.ig-search::placeholder { color: var(--ig-text-muted); }
.ig-close {
    flex: none; width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid transparent; background: transparent; color: var(--ig-text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.ig-close:hover { background: var(--ig-panel-hover); color: var(--ig-text-head); border-color: var(--ig-border); }

/* v57 DESKTOP APP: the floating window controls (#igTitlebar — fixed top
   40px strip, z-index 99999, ABOVE this backdrop's 99990) sit over the
   shell's top bar whenever the window is short / not maximized: the card
   centers in the full window height, so its top bar rose into the strip and
   the min/max/close hit area (pointer-events:auto) covered the search bar —
   it simply wasn't clickable. Push the card below the controls strip so the
   top bar always clears them. (No-op in a browser: .ig-app is only added
   inside the desktop app.) */
.ig-app .ig-backdrop { padding-top: calc(var(--tb-h, 40px) + 14px); }

/* ---------- body ---------- */
.ig-body { flex: 1; display: flex; min-height: 0; }
.ig-rail {
    flex: none; width: 172px;
    border-right: 1px solid var(--ig-border);
    padding: 14px 10px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.ig-rail-item {
    text-align: left; border: 0; background: transparent;
    color: var(--ig-text-muted);
    font-size: 13px; padding: 7px 10px; border-radius: 7px;
    cursor: pointer; position: relative;
    transition: color .12s, background .12s;
    display: flex; align-items: center; gap: 8px;
    white-space: nowrap; overflow: hidden;
}
.ig-rail-item:hover { background: rgba(255,255,255,.04); color: var(--ig-text); }
.ig-rail-ic { display: inline-flex; align-items: center; justify-content: center; opacity: .8; }
.ig-rail-item:hover .ig-rail-ic { opacity: 1; }
.ig-rail-active .ig-rail-ic { opacity: 1; color: var(--ig-accent); }
.ig-rail-lb { overflow: hidden; text-overflow: ellipsis; }
.ig-rail-active {
    background: rgba(76,194,255,.12);
    color: var(--ig-text-head);
    font-weight: 600;
    box-shadow: 0 0 18px var(--ig-accent-glow);
}
.ig-rail-active::before {
    content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
    width: 3px; border-radius: 3px; background: var(--ig-accent);
}
.ig-content {
    flex: 1; min-width: 0; overflow-y: auto;
    padding: 18px 22px 26px;
    scroll-behavior: smooth;
    background: var(--ig-panel);
}
@media (prefers-reduced-motion: reduce) { .ig-content { scroll-behavior: auto; } }

/* legacy section styling inside the shell: keep them visually separate */
.ig-content .soc-set-sec {
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: rgba(255,255,255,.018);
    border: 1px solid var(--ig-border);
    scroll-margin-top: 10px;
}

/* ---------- search dim/highlight ---------- */
.ig-dim { opacity: .22; pointer-events: none; transition: opacity .15s; }
.ig-hit { background: rgba(76,194,255,.10); border-radius: 6px; box-shadow: 0 0 0 1px rgba(76,194,255,.28); }
.ig-hit.ig-snd-hit, .soc-snd-row.ig-hit { display: flex; align-items: center; }

/* ---------- footer ---------- */
.ig-footer {
    flex: none; display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid var(--ig-border);
    background: rgba(255,255,255,.02);
}
.ig-footer[hidden] { display: none; }
.ig-footer-note { margin-right: auto; font-size: 12.5px; color: var(--ig-text-muted); }
.ig-fbtn {
    border: 1px solid var(--ig-border); background: var(--ig-panel-hover);
    color: var(--ig-text); border-radius: 8px; padding: 8px 16px;
    font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: background .12s, transform .08s;
    display: inline-flex; align-items: center; gap: 7px;
}
.ig-fbtn:hover { background: #34363d; }
.ig-fbtn:active { transform: scale(.98); }
.ig-fbtn-done, .ig-fbtn-save { background: var(--ig-accent); border-color: transparent; color: #06222e; }
.ig-fbtn-done:hover, .ig-fbtn-save:hover { background: #5fc6ff; }
.ig-fbtn-save.ig-saved { background: var(--ig-success); color: #fff; }
.ig-fbtn-discard { background: transparent; }
.ig-footer-note { display: inline-flex; align-items: center; gap: 6px; }
.ig-footer-note .ig-ic { color: var(--ig-text-muted); }
/* unsaved-changes pulse dot (S6) */
.ig-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--ig-warning);
    box-shadow: 0 0 8px rgba(240,178,50,.6); display: inline-block; flex: none;
    animation: igPulse 1.8s ease-in-out infinite;
}
@keyframes igPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .ig-dot { animation: none; } }

/* ---------- command palette ---------- */
.ig-pal-back { align-items: flex-start; padding-top: 12vh; }
.ig-pal {
    width: min(640px, 100%);
    background: var(--ig-bg);
    border: 1px solid var(--ig-border);
    border-radius: 12px;
    box-shadow: 0 20px 70px rgba(0,0,0,.6);
    overflow: hidden;
    animation: igPop 140ms ease-out;
}
.ig-pal-inwrap { padding: 10px 12px; border-bottom: 1px solid var(--ig-border); }
.ig-pal-in {
    width: 100%; box-sizing: border-box;
    background: var(--ig-panel); border: 1px solid var(--ig-border);
    border-radius: 8px; padding: 10px 12px;
    color: var(--ig-text); font-size: 14px; outline: none;
}
.ig-pal-in:focus { border-color: var(--ig-accent); box-shadow: 0 0 0 3px var(--ig-accent-glow); }
.ig-pal-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.ig-pal-group {
    font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--ig-text-muted);
    padding: 10px 10px 4px;
    display: flex; align-items: center; gap: 6px;
}
.ig-pal-gic { display: inline-flex; align-items: center; opacity: .85; }
.ig-pal-gic .ig-ic { color: var(--ig-accent); }
.ig-pal-item {
    display: flex; align-items: baseline; gap: 10px;
    padding: 8px 10px; border-radius: 8px; cursor: pointer;
    color: var(--ig-text);
}
.ig-pal-item:hover { background: rgba(255,255,255,.04); }
.ig-pal-sel { background: rgba(76,194,255,.16); box-shadow: inset 0 0 0 1px rgba(76,194,255,.42); }
.ig-pal-label { font-size: 13.5px; font-weight: 500; }
.ig-pal-hint { margin-left: auto; font-size: 11.5px; color: var(--ig-text-muted); white-space: nowrap; }
.ig-pal-empty { padding: 18px 12px; color: var(--ig-text-muted); font-size: 13px; }

/* ---------- mobile: rail becomes a chip row under the top bar ---------- */
@media (max-width: 767px) {
    .ig-backdrop { padding: 0; align-items: stretch; }
    .ig-shell { width: 100%; height: 100%; border-radius: 0; border: 0; }
    .ig-body { flex-direction: column; }
    .ig-rail {
        width: 100%; flex-direction: row; overflow-x: auto; overflow-y: hidden;
        border-right: 0; border-bottom: 1px solid var(--ig-border);
        padding: 8px 10px; gap: 6px; -webkit-overflow-scrolling: touch;
    }
    .ig-rail-item { flex: none; padding: 6px 12px; border: 1px solid var(--ig-border); border-radius: 999px; }
    .ig-rail-active::before { display: none; }
    .ig-content { padding: 14px 12px 90px; }
    /* v56.3: the search bar must stay visible on mobile too (the plan says
       "search bar persists at top of every screen"). It was hidden here,
       which made the server-settings search box "not clickable" on phones
       and any narrow (<768px) window. Now the title shrinks instead. */
    .ig-top { padding: 10px 12px; gap: 8px; }
    .ig-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
    .ig-searchwrap { flex: 1 1 auto; min-width: 60px; padding: 6px 8px; }
    .ig-search { font-size: 13px; }
}

/* ---------- role editor (Mode B) ---------- */
.ig-sec-title {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--ig-text-muted);
    margin: 0 0 10px;
}
.ig-role-cols { display: grid; grid-template-columns: 220px 1fr 1.2fr; gap: 18px; align-items: start; }
.ig-role-col { min-width: 0; }
.ig-role-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.ig-role-row {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid transparent; background: transparent;
    border-radius: 8px; padding: 8px 10px;
    color: var(--ig-text); font-size: 13px; cursor: pointer;
    transition: background .12s;
    text-align: left;
}
.ig-role-row:hover { background: rgba(255,255,255,.04); }
.ig-role-cur { background: rgba(76,194,255,.14); border-color: rgba(76,194,255,.42); box-shadow: 0 0 16px var(--ig-accent-glow); }
.ig-role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ig-role-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-role-count { font-size: 11px; color: var(--ig-text-muted); background: rgba(255,255,255,.06); border-radius: 999px; padding: 1px 7px; }
.ig-role-lock { font-size: 11px; }
@media (max-width: 900px) {
    .ig-role-cols { grid-template-columns: 1fr; }
    .ig-role-list { max-height: 180px; }
}

/* ---------- permission matrix: effective column ---------- */
.perm-simbar select, .perm-simbar .soc-input { background: var(--ig-panel); border: 1px solid var(--ig-border); color: var(--ig-text); border-radius: 6px; }
.perm-eff-col { position: sticky; right: 0; background: #26282c; }
.perm-cell.perm-eff { position: sticky; right: 0; background: #26282c; text-align: center; }
.perm-eff-mark { font-weight: 700; font-size: 13px; color: var(--ig-text-muted); }
.perm-eff-mark.ok { color: var(--ig-success); }
.perm-eff-mark.no { color: var(--ig-danger); }
.perm-eff-mark.err { color: var(--ig-warning); }

/* ---------- S6: contextual first-visit hint pill ---------- */
.ig-hint {
    display: flex; align-items: center; gap: 9px;
    background: rgba(76,194,255,.10);
    border: 1px solid rgba(76,194,255,.30);
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 14px;
    font-size: 12.5px; color: var(--ig-text);
    box-shadow: 0 0 18px rgba(76,194,255,.10);
    animation: igHintIn .22s ease-out;
}
@keyframes igHintIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ig-hint.out { opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; }
.ig-hint-ic { display: inline-flex; color: var(--ig-accent); flex: none; }
.ig-hint-tx { flex: 1; line-height: 1.45; }
.ig-hint-x {
    flex: none; width: 22px; height: 22px; border-radius: 6px;
    border: 0; background: transparent; color: var(--ig-text-muted);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    transition: background .12s, color .12s;
}
.ig-hint-x:hover { background: rgba(255,255,255,.06); color: var(--ig-text-head); }

/* ---------- S6: empty states (custom, no emoji) ---------- */
.ig-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 22px 14px; text-align: center;
    color: var(--ig-text-muted); font-size: 12.5px; line-height: 1.5;
}
.ig-empty .ig-empty-ic {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(76,194,255,.08); color: var(--ig-accent);
    border: 1px solid rgba(76,194,255,.22);
    box-shadow: 0 0 22px rgba(76,194,255,.12);
}
.ig-empty b { color: var(--ig-text); font-size: 13px; font-weight: 600; }

/* keyboard focus visibility */
.ig-rail-item:focus-visible, .ig-close:focus-visible, .ig-fbtn:focus-visible,
.ig-pal-item:focus-visible, .ig-search:focus-visible, .ig-hint-x:focus-visible {
    outline: 2px solid var(--ig-accent); outline-offset: 2px;
}
