/* --- UHA THEME VARIABLES --- */
:root {
    --bg-main: #121212;
    --bg-panel: #1e1e1e;
    --uha-blue: #3498db;
    --uha-gold: #f1c40f;
    --text-light: #ffffff;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --green-win: #27ae60;
    --red-lose: #c0392b;
}

/* --- GLOBAL STYLES --- */
body {
    background-color: var(--bg-main);
    color: var(--text-light);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
}

.uha-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-panel);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.7);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

/* --- HEADER --- */
#connection-status {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: bold;
}

/* --- LAYOUT & PANELS --- */
.section-title {
    color: var(--uha-blue);
    text-transform: uppercase;
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.setup-columns {
    display: flex;
    gap: 25px;
    align-items: stretch;
}

.column {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* --- INPUTS & CONTROLS --- */
input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 10px;
    background: #111;
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* --- BUTTONS --- */
.uha-btn {
    background: #27ae60; 
    color: white; 
    border: none;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    text-transform: uppercase;
    transition: filter 0.2s;
}
.uha-btn:hover { filter: brightness(1.1); }

.uha-btn-gold {
    background: var(--uha-gold);
    color: black;
    font-weight: bold;
}

.uha-btn-blue {
    background: var(--uha-blue);
    color: white;
    font-weight: bold;
}

.uha-btn-outline {
    background: transparent;
    color: white;
    border: 1px solid white;
    padding: 12px;
    width: 100%;
    cursor: pointer;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
    transition: background 0.2s;
}
.uha-btn-outline:hover { background: rgba(52, 152, 219, 0.1); }

/* --- TOGGLES --- */
.mode-toggle {
    display: flex;
    background: #111;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.mode-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
}
.mode-btn.active { background: var(--uha-blue); color: white; }

/* --- LISTS & DRAFTS --- */
#player-list {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}
#player-list::-webkit-scrollbar { width: 6px; }
#player-list::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

.player-item {
    background: #252525;
    border: 1px solid #333;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    transition: border-color 0.2s;
}
.player-item:hover { border-color: var(--uha-blue); }

.singles-slot {
    background: #111;
    border: 1px solid #444;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    border-left: 3px solid var(--uha-gold);
}
.remove-team-btn { background: none; border: none; color: var(--red-lose); cursor: pointer; font-weight: bold; padding: 0 5px; }

.team-slot {
    border: 1px solid #444;
    border-radius: 4px;
    margin-bottom: 15px;
    background: #111;
    overflow: hidden;
    border-left: 3px solid var(--uha-gold);
}
.team-header {
    background: #222;
    padding: 8px 12px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    color: var(--text-muted);
}
.slots { padding: 10px; min-height: 40px; }

/* --- BRACKET & MATCH CARDS --- */
.bracket-wrapper {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1 1 240px; 
    min-width: 180px; 
    max-width: 260px; 
    gap: 15px;
}

.bracket-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    min-width: 160px; 
    max-width: 240px;
    gap: 10px;
}

.match-card {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.match-team {
    font-size: 13px; line-height: 1.3; overflow-wrap: break-word; font-weight: bold; font-size: 13px; display: flex; justify-content: space-between; }
.match-vs { color: var(--text-muted); font-size: 11px; margin: 5px 0; text-align: center; }

.text-win { color: var(--green-win) !important; }
.text-lose { color: var(--red-lose) !important; }

.unlock-btn {
    font-size: 11px;
    padding: 4px 8px;
    background: #444;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    float: right;
}
.unlock-btn:hover { background: #555; }

/* --- ENHANCED BRACKET LAYOUT --- */
.bracket-layout {
    display: flex;
    flex-direction: column;
}
.bracket-header {
    text-align: center;
    color: var(--uha-gold);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.bracket-columns {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 20px 0;
    align-items: stretch;
}

/* --- ROUND ROBIN GRID --- */
.rr-match-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 20px auto 40px auto;

    max-width: 850px; 
}

.rr-match-grid .match-card {
    flex: 0 1 240px; 
    margin: 0;
    box-sizing: border-box;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .rr-match-grid .match-card {
        flex: 0 1 100%;
        max-width: 320px;
    }
}

/* --- STANDINGS TABLE --- */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #1a1a1a;
    border-radius: 6px;
    overflow: hidden;
    font-size: 14px;
}
.standings-table th, .standings-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}
.standings-table th { 
    background: #222; 
    color: var(--uha-gold); 
}
.standings-table tr:hover {
    background: #252525;
}

.standings-table th:first-child, 
.standings-table td:first-child { 
    text-align: left; 
    padding-left: 15px;
}

/* --- MODALS --- */
.uha-modal {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 0, 0, 0.85); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 1000;
}

.uha-modal-content {
    background: var(--bg-panel); 
    padding: 25px; 
    border-radius: 6px; 
    border: 1px solid var(--border-color); 
    width: 90%; 
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.score-row {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 10px; 
    background: #111; 
    padding: 10px; 
    border-radius: 4px;
}

.score-input {
    width: 50px; 
    background: #222; 
    color: white; 
    border: 1px solid #444; 
    padding: 8px; 
    text-align: center; 
    font-size: 16px; 
    border-radius: 4px;
}

.score-input:focus { 
    border-color: var(--uha-blue); 
    outline: none; 
}

#btn-back-setup {
    padding: 6px 12px; /* Reduces the bulk of the button */
    font-size: 0.85em; /* Scales down the text slightly */
    width: auto; /* Ensures it only takes up as much space as the text needs */
}
