:root {
    --bg: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 2rem;
    min-height: 100vh;
}

main {
    display: grid;
    gap: 1rem;
}

/* -------------------------------------
 * Login Container
 * ------------------------------------- */
#login-container {
    max-width: 400px;
    margin: 20vh auto;
    background: var(--panel-bg);
    padding: 2rem;
    border-radius: 1rem;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#login-container input {
    width: 100%;
    padding: 12px;
    margin: 1rem 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: white;
    border-radius: 0.5rem;
    box-sizing: border-box;
}

#login-container button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

#login-container button:hover {
    background: var(--primary-hover);
}

#login-error {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.9em;
}

/* -------------------------------------
 * Dashboard Header
 * ------------------------------------- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.8rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.stats span {
    background: var(--panel-bg);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    font-size: 0.9em;
}

.dashboard-tabs {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tab-button {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.75rem 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.tab-button:hover {
    color: var(--text);
    border-color: rgba(59, 130, 246, 0.5);
}

.tab-button.active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.55);
    color: white;
}

/* -------------------------------------
 * Datatable
 * ------------------------------------- */
.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.panel h2 {
    margin-top: 0;
    font-size: 1.2rem;
    color: var(--muted);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 0.9rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 700;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.table-container {
    overflow-x: auto;
}

.status-banner {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.status-banner.is-success {
    color: #86efac;
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
}

.status-banner.is-error {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
}

.crypto-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.crypto-status-card {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.04);
}

.crypto-status-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.crypto-status-value {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* -------------------------------------
 * Badges & Buttons
 * ------------------------------------- */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.edit-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.2s;
}

.edit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.actions-cell {
    min-width: 220px;
}

.action-stack {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.moderation-btn {
    border: 1px solid transparent;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: 0.2s;
}

.moderation-btn--danger {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.35);
}

.moderation-btn--danger:hover {
    background: rgba(239, 68, 68, 0.28);
}

.moderation-btn--success {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.35);
}

.moderation-btn--success:hover {
    background: rgba(16, 185, 129, 0.28);
}

.moderation-pill {
    display: inline-flex;
    margin-top: 0.6rem;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.moderation-pill.is-live {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.28);
    color: #6ee7b7;
}

.moderation-pill.is-banned {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.28);
    color: #fca5a5;
}

.mono-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--muted);
}

.money-cell {
    color: #4ade80;
    font-weight: 700;
}

.subtle-text {
    font-size: 0.72rem;
    color: gray;
    margin-top: 0.4rem;
}

.metadata-cell {
    max-width: 320px;
    word-break: break-word;
    color: var(--muted);
    font-size: 0.78rem;
}

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 1.5rem;
}

.chat-box {
    height: 320px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.chat-box--history {
    height: 420px;
    margin-bottom: 0;
}

.chat-admin-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.chat-column {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.chat-section-title {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
}

.chat-history-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.chat-history-summary {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.chat-history-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.chat-history-select {
    min-width: 220px;
    padding: 0.7rem 0.85rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 0.5rem;
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-actions input {
    flex: 1;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: white;
    border-radius: 0.25rem;
}

.chat-actions button {
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.25rem;
    font-weight: bold;
    cursor: pointer;
}

.chat-actions button:hover {
    background: var(--primary-hover);
}

.chat-message {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.04);
}

.chat-message--system {
    border-color: rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.08);
}

.chat-message__meta {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
}

.chat-message__steam {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.74rem;
}

.chat-message__time {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.74rem;
}

.chat-message__body {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.45;
}

.chat-player-group {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.9rem;
    margin-bottom: 1rem;
}

.chat-player-group:last-child {
    margin-bottom: 0;
}

.chat-player-group__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-player-group__identity {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chat-player-group__steam {
    color: var(--muted);
    font-size: 0.76rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chat-player-group__count {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.chat-player-group__messages {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.chat-badges {
    color: #facc15;
    font-size: 0.8rem;
}

/* -------------------------------------
 * Edit Modal
 * ------------------------------------- */
.modal {
    display: none;
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg);
    margin: 15% auto;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close {
    color: var(--muted);
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: white;
}

#edit-form label {
    display: block;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--muted);
}

#edit-form input {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: white;
    border-radius: 0.25rem;
    box-sizing: border-box;
}

#edit-form button {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.8rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

#edit-form button:hover {
    background: #059669;
}
