/* ===== Ballpark Maestro Dark Theme ===== */
html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #1e1e2e;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
}

.maestro-app {
    min-height: 100vh;
}

.maestro-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 8px 16px;
}

/* Loading */
.loading {
    text-align: center;
    font-size: 24px;
    padding: 80px;
    color: #aaa;
}

/* Sidebar Controls */

/* --- Sidebar Toggle (pure CSS checkbox) --- */
.sidebar-toggle-check {
    display: none;
}

.sidebar-toggle {
    position: fixed;
    top: 12px;
    left: 216px;
    width: 28px;
    height: 28px;
    background: #2a2a3e;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 0;
    transition: left 0.2s ease;
    user-select: none;
}

.sidebar-toggle:hover {
    background: #4a4a6a;
    color: #fff;
}

/* Arrow direction: ◀ when expanded, ▶ when collapsed */
.sidebar-toggle::after {
    content: "◀";
}

.sidebar-toggle-check:checked ~ .sidebar .sidebar-toggle::after {
    content: "▶";
}

/* When checkbox is checked = sidebar collapsed */
.sidebar-toggle-check:checked ~ .sidebar .top-row,
.sidebar-toggle-check:checked ~ .sidebar .nav-scrollable {
    display: none !important;
}

.sidebar-toggle-check:checked ~ .sidebar {
    width: 40px !important;
    min-width: 40px !important;
    overflow: hidden;
}

.sidebar-toggle-check:checked ~ .sidebar .sidebar-toggle {
    left: 6px;
}

#sidebar-toggle-check:checked ~ main .sidebar-controls {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.sidebar-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: #1a1a2e;
    border-top: 1px solid #3a3a4a;
    z-index: 10;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.menu-btn {
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    text-align: left;
}
.menu-btn:hover { background: #4a4a6a; }

.stop-all-btn {
    background: #b71c1c;
    color: white;
    border: 2px solid #ef5350;
    border-radius: 6px;
    padding: 6px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.5px;
    width: 100%;
}
.stop-all-btn:hover { background: #d32f2f; }

.fade-out-btn {
    background: #f9a825;
    color: #1e1e2e;
    border: 2px solid #ffd740;
    border-radius: 6px;
    padding: 6px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.5px;
    width: 100%;
}
.fade-out-btn:hover { background: #fdd835; }

.spotify-status {
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

.spotify-status.clickable {
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: block;
    transition: background 0.2s;
}
.spotify-status.clickable:hover {
    background: #2a2a3a;
    color: #e0e0e0;
}

.spotify-menu {
    position: relative;
}

.spotify-dropdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
}

.device-list-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0 2px 0;
    border-top: 1px solid #3a3a4a;
    margin-top: 4px;
}

.device-active {
    border-color: #4caf50 !important;
    color: #4caf50 !important;
}

/* Scoreboard */
.scoreboard {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: stretch;
    margin-bottom: 12px;
}

.team-card {
    flex: 1;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.away-card {
    background: linear-gradient(to bottom, #4a4a5a, #8b7d3c);
}

.home-card {
    background: linear-gradient(to bottom, #4a4a5a, #2e7d32);
}

.team-name {
    font-size: 28px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.score-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.score {
    font-size: 52px;
    font-weight: bold;
    color: white;
    min-width: 60px;
}

.score-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 12px;
}
.score-btn:hover { color: #ffd740; }

/* Inning */
.inning-card {
    background: linear-gradient(to bottom, #505058, #3a3a42);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    min-width: 90px;
}

.inning-btn {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 8px;
}
.inning-btn:hover { color: white; }

.inning-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inning-half {
    font-size: 24px;
    color: #ffd740;
}

.inning-number {
    font-size: 36px;
    font-weight: bold;
    color: white;
}

/* Hits & Runs */
.hits-runs-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 8px;
    background: #2a2a3a;
    border-radius: 8px;
    margin-bottom: 12px;
}

.hits-runs-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: #ccc;
}

.small-btn {
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 14px;
}
.small-btn:hover { background: #4a4a6a; }

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .main-content .away-lineup {
        order: 1;
    }

    .main-content .field-panel {
        order: 2;
    }

    .main-content .home-lineup {
        order: 3;
    }
}

/* Lineup Panels */
.lineup-panel {
    background: #2a2a3a;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(400px * 2 + 24px * 2 + 16px);
}

.lineup-panel h3 {
    font-size: 18px;
    margin: 0 0 8px 0;
    color: #ffd740;
}

.quick-edit {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.quick-edit input {
    flex: 1;
    background: #1e1e2e;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 4px 8px;
    font-size: 13px;
}

.quick-edit button {
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 13px;
}

.lineup-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 3px;
    background: #3a3a4a;
    transition: background 0.2s;
}

.lineup-row.current-batter {
    background: linear-gradient(to right, #2e7d32, #1b5e20);
    box-shadow: 0 0 8px rgba(46, 125, 50, 0.5);
}

.lineup-pos {
    font-weight: bold;
    font-size: 16px;
    min-width: 20px;
    cursor: pointer;
    color: #ffd740;
}

.player-info {
    flex: 1;
    font-size: 14px;
    cursor: pointer;
}

.position-label {
    opacity: 0.6;
    font-size: 12px;
}

.icon-btn {
    background: transparent;
    border: 1px solid #555;
    color: #ccc;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
}
.icon-btn:hover { background: #4a4a6a; color: white; }

.play-btn { color: #4caf50; border-color: #4caf50; }
.play-btn:hover { background: #2e7d32; color: white; }

.bench-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #444;
    font-size: 13px;
    color: #999;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.bench-player {
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 1px;
}

.roster-active {
    color: #e0e0e0;
    background: rgba(46, 125, 50, 0.25);
    border-left: 3px solid #4caf50;
    padding-left: 6px;
}

.roster-tag {
    display: inline-block;
    background: rgba(255, 215, 64, 0.2);
    color: #ffd740;
    font-size: 10px;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 3px;
    margin-left: 4px;
}

.roster-edit-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 11px;
    padding: 0 3px;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.bench-player:hover .roster-edit-btn {
    opacity: 1;
}

.roster-add-btn, .roster-remove-btn {
    margin-left: auto;
    font-size: 10px;
    padding: 1px 5px;
    opacity: 0.5;
}
.bench-player:hover .roster-add-btn,
.bench-player:hover .roster-remove-btn {
    opacity: 1;
}

.roster-edit-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px;
    background: #1e1e2e;
    border-radius: 4px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.roster-edit-input {
    background: #2a2a3a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 3px 6px;
    font-size: 12px;
    flex: 1;
    min-width: 0;
}

.roster-edit-input.num-input {
    width: 42px;
    flex: 0 0 42px;
}

.roster-quick-add {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    border-top: 1px solid #444;
    margin-top: 4px;
}

.roster-edit-select {
    background: #2a2a3a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 3px 4px;
    font-size: 12px;
    flex: 0 0 auto;
}

.pitcher-btn {
    margin-top: 8px;
    width: 100%;
}

.pitcher-label {
    margin-top: 8px;
    padding: 6px 12px;
    background: #3a3a4a;
    border-radius: 6px;
    font-size: 13px;
    color: #ccc;
    text-align: center;
}

/* Field Panel */
.field-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.field-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.field-label {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    text-align: center;
}

.away-label {
    color: #d4a843;
}

.home-label {
    color: #66bb6a;
}

.field-diamond {
    position: relative;
    width: 360px;
    height: 400px;
    background: url('images/baseball-diamond.png') center/cover no-repeat;
    border-radius: 12px;
}

.field-position {
    position: absolute;
    text-align: center;
}

.field-position select {
    background: rgba(0,0,0,0.6);
    color: #e0e0e0;
    border: 1px solid #666;
    border-radius: 4px;
    font-size: 11px;
    padding: 2px;
    max-width: 110px;
}

.pos-label {
    font-size: 11px;
    font-weight: bold;
    color: #ffd740;
    margin-bottom: 2px;
}

/* Field position placements */
.pos-pitcher   { left: 50%; top: 58%; transform: translateX(-50%); }
.pos-catcher   { left: 50%; top: 82%; transform: translateX(-50%); }
.pos-first     { left: 75%; top: 52%; }
.pos-second    { left: 60%; top: 32%; }
.pos-third     { left: 12%; top: 52%; }
.pos-short     { left: 28%; top: 32%; }
.pos-left      { left: 5%;  top: 8%; }
.pos-center    { left: 42%; top: 2%; }
.pos-right     { left: 75%; top: 8%; }

/* Action Bar */
.action-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    background: #2a2a3a;
    border-radius: 12px;
    margin-bottom: 12px;
}

.action-group {
    flex: 1;
    min-width: 200px;
}

.action-group h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: #ffd740;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.action-btn {
    display: inline-block;
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 6px 12px;
    margin: 2px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.action-btn:hover { background: #4a4a6a; }

.vol-btn {
    min-width: 50px;
    text-align: center;
}

/* Status Bar */
.status-bar {
    background: #3a3a5a;
    color: #ffd740;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    margin-top: 8px;
}

/* Blazor error UI */
#blazor-error-ui {
    background: #b32121;
    color: white;
    padding: 0.5rem 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    display: none;
}

#blazor-error-ui .reload, #blazor-error-ui .dismiss {
    color: #ffd740;
    margin-left: 12px;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 8px;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ===== Page Title ===== */
.page-title {
    color: #ffd740;
    margin: 0 0 16px 0;
    font-size: 24px;
}

/* ===== Management Pages ===== */
.mgmt-section {
    background: #2a2a3a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.mgmt-section h3 {
    color: #ffd740;
    margin: 0 0 12px 0;
    font-size: 18px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.mgmt-input {
    background: #1e1e2e;
    border: 1px solid #555;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 6px 10px;
    font-size: 14px;
}

.mgmt-input:focus {
    border-color: #ffd740;
    outline: none;
}

.num-input {
    width: 60px;
}

.mgmt-select {
    background: #1e1e2e;
    border: 1px solid #555;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 6px 10px;
    font-size: 14px;
}

/* Team Block */
.team-block {
    background: #2a2a3a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.team-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.team-block-name {
    color: #ffd740;
    margin: 0;
    font-size: 20px;
    flex: 1;
}

.delete-btn {
    color: #ef5350 !important;
    border-color: #ef5350 !important;
}
.delete-btn:hover {
    background: #b71c1c !important;
    color: white !important;
}

/* Player Table */
.player-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 14px;
}

.player-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #444;
    color: #aaa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #333;
    color: #e0e0e0;
}

.player-table tr:hover td {
    background: #3a3a4a;
}

.add-player-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid #444;
}

/* ===== Game Setup Page ===== */
.setup-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.setup-card {
    flex: 1;
    min-width: 250px;
    background: #1e1e2e;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.setup-card h3 {
    margin: 0 0 12px 0;
}

.away-setup {
    border: 2px solid #8b7d3c;
}

.away-setup h3 {
    color: #d4a843;
}

.home-setup {
    border: 2px solid #2e7d32;
}

.home-setup h3 {
    color: #66bb6a;
}

.setup-vs {
    font-size: 32px;
    font-weight: bold;
    color: #666;
    align-self: center;
    padding: 20px 8px;
}

.team-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 15px;
    margin-bottom: 12px;
}

.team-preview {
    text-align: left;
    background: #2a2a3a;
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    font-size: 13px;
}

.team-preview strong {
    color: #ffd740;
    font-size: 15px;
}

.team-preview ul {
    margin: 6px 0 0 0;
    padding-left: 18px;
    color: #ccc;
}

.team-preview li {
    padding: 2px 0;
}

.setup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.start-btn {
    background: #2e7d32 !important;
    color: white !important;
    font-size: 16px !important;
    padding: 10px 24px !important;
}
.start-btn:hover {
    background: #1b5e20 !important;
}
.start-btn:disabled {
    background: #3a3a5a !important;
    color: #666 !important;
    cursor: not-allowed;
}
