/*
 * Game UI — Shared Component Classes
 * ====================================
 * Reusable patterns extracted from the modern flat redesign.
 * Uses --w-* tokens from design-system.css.
 * All classes prefixed .g- to distinguish from .w-* (design system) classes.
 *
 * Usage: Add class names to DOM elements built in JS modules.
 * These complement, not replace, component-specific styles (.sm-*, .tt-*, .sc-*).
 */

/* ── Backdrop (fullscreen overlay behind modals) ── */
.g-backdrop {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0; transition: opacity 0.2s ease;
    pointer-events: none;
}
.g-backdrop.open { opacity: 1; pointer-events: auto; }

/* ── Frame (modal/panel container) ── */
.g-frame {
    background: var(--w-bg-secondary);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius-md);
    font-family: var(--w-font-body);
    color: var(--w-text-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Header (top bar with title + close) ── */
.g-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--w-bg-input);
    border-bottom: 1px solid var(--w-border);
    padding: 0;
    flex-shrink: 0;
}

/* ── Tab bar ── */
.g-tabs {
    display: flex;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, black 90%, transparent 100%);
    mask-image: linear-gradient(90deg, black 90%, transparent 100%);
}
.g-tabs::-webkit-scrollbar { display: none; }

/* ── Individual tab ── */
.g-tab {
    background: none;
    border: none;
    color: var(--w-text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.g-tab:hover {
    color: var(--w-text-primary);
    background: rgba(139, 108, 199, 0.06);
}
.g-tab.active {
    color: var(--w-accent);
    border-bottom-color: var(--w-accent);
    background: rgba(230, 193, 112, 0.06);
}

/* ── Close button (error pill) ── */
.g-close {
    background: rgba(248, 113, 113, 0.15);
    color: var(--w-error);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    padding: 0 8px;
    line-height: 24px;
    margin: 6px 8px;
    transition: all 0.15s;
}
.g-close:hover {
    background: rgba(248, 113, 113, 0.25);
    border-color: var(--w-error);
}

/* ── Content area ── */
.g-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--w-bg-secondary);
}

/* ── Section title ── */
.g-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--w-accent);
    margin: 0 0 14px;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--w-border);
}
.g-section-title:not(:first-child) { margin-top: 28px; }

/* ── Data / setting row ── */
.g-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 6px;
    border-bottom: 1px solid var(--w-border-subtle);
}
.g-row:last-child { border-bottom: none; }

/* ── Keyboard key badge ── */
.g-kbd {
    display: inline-block;
    background: var(--w-bg-tertiary);
    border: 1px solid var(--w-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--w-font-mono);
    font-size: 11px;
    color: var(--w-accent);
    line-height: 1.4;
    min-width: 20px;
    text-align: center;
}
