/* Kaizen DB — Dark theme */
:root {
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #0f3460;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --text: #eee;
    --text-muted: #999;
    --border: #2a2a4a;
    --success: #4caf50;
    --warning: #ff9800;
    --info: #2196f3;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    font-size: 14px;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 2px solid var(--accent);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 20px;
    color: var(--accent);
    font-weight: 700;
}

.header nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-size: 13px;
    transition: color 0.2s;
}
.header nav a:hover, .header nav a.active {
    color: var(--text);
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

.two-col {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 15px;
}

/* Sidebar */
.sidebar {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 12px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 60px;
}

.sidebar h3 {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.sidebar-item {
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}
.sidebar-item:hover { background: var(--bg-input); }
.sidebar-item.active { background: var(--accent); color: #fff; }
.sidebar-item .count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-dark);
    padding: 1px 6px;
    border-radius: 10px;
}

/* Forms & Controls */
select, input[type="text"], input[type="password"], input[type="date"] {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}
select:focus, input:focus {
    border-color: var(--accent);
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    display: inline-block;
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    text-decoration: none;
    color: #fff;
}
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #000; }
.btn-info { background: var(--info); }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 6px;
    overflow: hidden;
}
th, td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
th {
    background: var(--bg-input);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    position: sticky;
    top: 0;
}
tr:hover { background: rgba(233, 69, 96, 0.05); }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-finished { background: var(--success); color: #fff; }
.badge-scheduled { background: var(--info); color: #fff; }
.badge-live { background: var(--accent); color: #fff; animation: pulse 1.5s infinite; }
.badge-postponed { background: var(--warning); color: #000; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 15px;
}
.tab {
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 13px;
    transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}
.card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--accent);
}

/* Match header */
.match-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 15px;
}
.match-header .team-name {
    font-size: 18px;
    font-weight: 700;
    min-width: 200px;
}
.match-header .team-name:first-child { text-align: right; }
.match-header .score {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    min-width: 80px;
    text-align: center;
}
.match-header .meta {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
}

/* Grid for two-panel layouts */
.split-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Player popup */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h2 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 16px;
}
.modal .close-btn {
    float: right;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 20px;
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 20px;
    transition: 0.2s;
}
.toggle .slider:before {
    content: "";
    position: absolute;
    height: 14px; width: 14px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider:before { transform: translateX(16px); }

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 8px;
    width: 350px;
}
.login-box h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--accent);
}
.login-box input {
    width: 100%;
    margin-bottom: 15px;
    padding: 10px;
}
.login-box .btn { width: 100%; padding: 10px; font-size: 15px; }
.flash-error {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
    text-align: center;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}
.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Player name link */
.player-link {
    color: var(--info);
    cursor: pointer;
    text-decoration: none;
}
.player-link:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 900px) {
    .two-col { grid-template-columns: 1fr; }
    .split-panel { grid-template-columns: 1fr; }
    .match-header { flex-direction: column; gap: 10px; }
    .match-header .team-name { text-align: center !important; min-width: auto; }
}
