:root {
    --bg-color: #f4f6f8;
    --panel-bg: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #6b7280;
    --brand-primary: #10B981; /* Emerald Green */
    --brand-hover: #059669;
    --brand-secondary: #E5E7EB;
    --brand-secondary-hover: #D1D5DB;
    --danger: #EF4444;
    --danger-hover: #B91C1C;
    --border-color: #E5E7EB;
    --pitch-bg: #FFFFFF; /* White pitch for better heatmap visibility */
    --pitch-lines: rgba(0, 0, 0, 0.2);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebars */
.sidebar-left, .sidebar-right {
    background-color: var(--panel-bg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-right: 1px solid var(--border-color);
    width: 280px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    overflow: hidden;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border-color);
    width: 320px;
}

/* Typography */
h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-primary);
}

h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.brand p {
    font-size: 12px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    border: none;
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
}

.btn-primary:not(:disabled):hover {
    background-color: var(--brand-hover);
}

.btn-secondary {
    background-color: var(--brand-secondary);
    color: var(--text-main);
}

.btn-secondary:not(:disabled):hover {
    background-color: var(--brand-secondary-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:not(:disabled):hover {
    background-color: var(--danger-hover);
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

.file-upload-label {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
}

/* Settings */
.select-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    background-color: white;
    cursor: pointer;
    color: var(--text-main);
}

.select-input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.setting-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 4px;
    display: block;
}

/* Edit Player area */
.players-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.edit-player-controls {
    display: flex;
    margin-bottom: 8px;
}

.input-with-button {
    position: relative;
    width: 100%;
}

.input-with-button input {
    width: 100%;
    padding: 6px 56px 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
}

.input-with-button input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.btn-inline {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-inline:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-inline:not(:disabled):hover {
    background: var(--brand-hover);
}

/* Player List */
.player-list-container {
    flex: 1;
    overflow-y: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f9fafb;
}

#player-list {
    list-style: none;
}

#player-list li {
    padding: 5px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s;
    font-size: 12px;
}

#player-list li:last-child {
    border-bottom: none;
}

#player-list li:hover {
    background-color: var(--brand-secondary);
}

#player-list li.selected {
    background-color: var(--brand-primary);
    color: white;
    font-weight: 500;
}

.selected-player-info {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-muted);
}

.selected-player-info strong {
    color: var(--text-main);
    font-size: 16px;
    margin-left: 4px;
}

/* Main Content area */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-color);
}

.canvas-container {
    background-color: var(--pitch-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    /* Aspect ratio 120/90 = 4:3 */
    aspect-ratio: 4/3;
    max-height: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    cursor: crosshair;
}

/* Event Table */
.table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th {
    position: sticky;
    top: 0;
    background-color: #f3f4f6;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background-color: #f9fafb;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* Responsiveness */
@media (max-width: 1200px) {
    .sidebar-left { width: 220px; }
    .sidebar-right { width: 260px; }
    .main-content { padding: 10px; }
}

@media (max-width: 900px) {
    body { height: auto; overflow-y: auto; }
    .app-container { flex-direction: column; height: auto; }
    .sidebar-left, .sidebar-right { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); flex: none; height: auto; overflow-y: visible; }
    .main-content { min-height: 50vh; padding: 16px; }
    .players-group { min-height: 240px; }
    .player-list-container { overflow-y: auto; }
    .table-container { min-height: 300px; overflow-y: auto; }
}
