:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #f1f5f9; /* Soft Slate Light */
    --bg-card: rgba(255, 255, 255, 0.7); /* White with transparency */
    --bg-terminal: #fafafa; /* Light Slate/White for logs terminal */
    --text-main: #0f172a; /* Dark Slate */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: rgba(0, 0, 0, 0.06);
    
    --color-red: #e11d48; /* Rose 600 for visibility */
    --color-blue: #2563eb; /* Blue 600 */
    --color-green: #16a34a; /* Green 600 */
    --color-yellow: #ca8a04; /* Yellow 600 */
    --color-purple: #7c3aed; /* Violet 600 */
    --color-pink: #db2777; /* Pink 600 */
    
    --font-main: 'Inter', sans-serif;
    --font-title: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.main-container {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    font-family: var(--font-title);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
}

/* Page Status Banner */
.status-banner {
    display: none;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    margin-top: 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}
.status-banner.show { display: block; }
.status-banner.err { background-color: rgba(225, 29, 72, 0.1); border: 1px solid rgba(225, 29, 72, 0.2); color: #be123c; }
.status-banner.ok { background-color: rgba(22, 163, 74, 0.1); border: 1px solid rgba(22, 163, 74, 0.2); color: #047857; }

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.header-row h1 {
    font-family: var(--font-title);
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}
.btn:hover {
    background: rgba(0, 0, 0, 0.03);
}
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Main Layout Grid */
.logs-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 180px);
    margin-bottom: 2rem;
}

/* Sidebar Columns */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    max-height: 450px;
}

.sidebar-panel h2 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: var(--primary-color);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    color: white;
}

.match-list {
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 4px;
}

.match-list::-webkit-scrollbar {
    width: 6px;
}
.match-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.match-item {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid var(--border-color);
    padding: 0.85rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.match-item:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}
.match-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--primary-color);
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.05);
}

.match-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.match-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}
.match-item-players {
    font-size: 0.75rem;
    margin-top: 0.4rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Center Logs Viewer Panel */
.logs-viewer {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.logs-title-info h3 {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
}
.logs-title-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.logs-actions {
    display: flex;
    gap: 0.75rem;
}

.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-input {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 0.85rem;
    flex-grow: 1;
}
.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 0.85rem;
    min-width: 150px;
    cursor: pointer;
}
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}
.filter-select option {
    color: var(--text-main);
    background: white;
}

/* Terminal Console logs table */
.terminal {
    background: var(--bg-terminal);
    border-radius: 14px;
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 600px;
}

.terminal-row {
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    padding-bottom: 0.4rem;
    align-items: flex-start;
}
.terminal-time {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.75rem;
}

.tag-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
    text-align: center;
    min-width: 90px;
}
.tag-started { background: rgba(56, 189, 248, 0.15); color: var(--color-blue); border: 1px solid rgba(56, 189, 248, 0.3); }
.tag-ended { background: rgba(244, 63, 94, 0.15); color: var(--color-red); border: 1px solid rgba(244, 63, 94, 0.3); }
.tag-roll { background: rgba(192, 132, 252, 0.15); color: var(--color-purple); border: 1px solid rgba(192, 132, 252, 0.3); }
.tag-move { background: rgba(52, 211, 153, 0.15); color: var(--color-green); border: 1px solid rgba(52, 211, 153, 0.3); }
.tag-forfeit { background: rgba(251, 191, 36, 0.15); color: var(--color-yellow); border: 1px solid rgba(251, 191, 36, 0.3); }
.tag-skipped { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.3); }
.tag-chat { background: rgba(244, 114, 182, 0.15); color: var(--color-pink); border: 1px solid rgba(244, 114, 182, 0.3); }

.terminal-player {
    color: var(--text-main);
    font-weight: 600;
    flex-shrink: 0;
    min-width: 100px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.terminal-detail {
    color: #334155;
    word-break: break-word;
}
.terminal-metadata {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    background: rgba(0, 0, 0, 0.02);
    padding: 0.25rem;
    border-radius: 4px;
    display: none;
}

.terminal-row:hover .terminal-metadata {
    display: block;
}

.terminal-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
}

/* Footer reset auth link styling */
.reset-auth-container {
    text-align: center;
    margin-top: 3rem;
    padding-bottom: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.reset-auth-link {
    color: var(--primary-color);
    text-decoration: none;
    margin-left: 0.5rem;
}
.reset-auth-link:hover {
    text-decoration: underline;
}

/* Background Orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0.08;
}
.orb-1 { width: 450px; height: 450px; background-color: var(--color-blue); top: -100px; left: -100px; }
.orb-2 { width: 500px; height: 500px; background-color: var(--primary-color); bottom: -150px; right: -150px; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .logs-grid {
        grid-template-columns: 1fr;
    }
    .sidebar-panel {
        max-height: 250px;
    }
}

/* Meta Collapse Panel Styling */
.meta-collapse-panel {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.meta-collapse-header {
    background: rgba(0, 0, 0, 0.02);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}
.meta-collapse-header:hover {
    background: rgba(0, 0, 0, 0.04);
}

.meta-collapse-content {
    padding: 1rem;
    display: none;
    animation: fadeIn 0.2s ease;
}
.meta-collapse-content.show {
    display: block;
}

/* Metadata Grid */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.meta-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
}
.meta-card h4 {
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}
.meta-item:last-child {
    margin-bottom: 0;
}
.meta-label {
    color: var(--text-muted);
}
.meta-value {
    color: var(--text-main);
    font-weight: 500;
}

/* Bot Table */
.bot-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 1rem;
    background: white;
}
.bot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    text-align: left;
    min-width: 800px;
}
.bot-table th {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.bot-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-main);
}
.bot-table tr:last-child td {
    border-bottom: none;
}
.bot-table tr:hover {
    background: rgba(0, 0, 0, 0.01);
}
.bot-badge {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-color);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 600;
}
.status-yes {
    color: var(--color-green);
    font-weight: 600;
}
.status-no {
    color: var(--color-red);
    font-weight: 600;
}
