/* game-styles.css - Styles for the Bench Balancer Game Application (game.html) */

/* ... (Keep existing body, a, #appHeader, #mastheadLogo styles) ... */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0;
    background-color: #f4f4f4; /* Light gray background */
    color: #333; /* Default text color */
}

body a { color: #007bff; text-decoration: none; } /* Standard link blue */
body a:hover { text-decoration: underline; }
body a:visited { color: #0056b3; } /* Darker blue for visited */

/* Header Area for game.html */
#appHeader {
    background-color: #004080; /* Darker, professional blue */
    color: #ffffff; /* White text */
    padding: 10px 20px;
    text-align: center;
    border-bottom: 3px solid #002f5e; /* Slightly darker border for depth */
}

#mastheadLogo {
    width: 100%;
    max-height: 80px; /* Adjusted for typical banner proportions */
    height: auto;
    object-fit: contain;
    display: block;
    margin: 5px auto 10px auto; /* Center and add space */
}


/* TOP SPONSOR BANNER (Primarily for Setup Screen) */
#topSponsorBanner {
    background-color: #e9ecef;
    color: #004080;
    padding: 10px 20px;
    text-align: center;
    font-size: 0.95rem; /* Slightly larger for better prominence */
    font-weight: 500;
    border-radius: 0 0 8px 8px;
    margin: 0 auto 15px auto;
    max-width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    line-height: 1.4;
}
#topSponsorBanner a {
    color: #0056b3;
    text-decoration: none;
    font-weight: bold; /* Keep bold for emphasis */
}
#topSponsorBanner a:hover {
    text-decoration: underline;
}

/* ... (Keep h1, h2, h3, .small-note, #setup, .form-group, input/select styles as updated previously) ... */
h1 { /* Not used in game.html directly, but good to have consistent */
    text-align: center;
    color: #004080;
    margin-top: 20px;
    margin-bottom: 20px;
    font-size: 2rem;
    font-family: "Poppins", sans-serif;
}

h2, h3 { text-align: center; color: #1f3a5f; font-family: "Poppins", sans-serif; } /* Darker blue */
h2 { margin-top: 20px; margin-bottom: 20px; font-size: 1.6rem; }
h3 { font-size: 1.25rem; margin-bottom: 15px; }
.small-note { font-size: 0.85rem; color: #5a6268; margin-top: 5px; margin-bottom: 0; }

/* Setup Card Styling */
#setup {
    background-color: #ffffff; /* White background */
    padding: 25px 30px; /* More padding */
    border-radius: 12px; /* More rounded corners */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); /* Softer, more modern shadow */
    max-width: 550px; /* Slightly wider for better form layout */
    margin: 25px auto; /* More top/bottom margin */
}
.form-group { margin-bottom: 18px; } /* Increased spacing */
.form-group label {
    display: block;
    margin-bottom: 6px; /* More space below label */
    font-weight: 600; /* Bolder labels */
    color: #343a40; /* Dark gray for labels */
    font-size: 0.95rem;
}
.form-group input[type="number"],
.form-group select,
.form-group input.player-name-input
{
    width: 100%;
    padding: 12px 15px; /* More padding */
    border: 1px solid #ced4da; /* Lighter gray border */
    border-radius: 6px; /* Slightly more rounded inputs */
    font-size: 1rem;
    box-sizing: border-box;
    background-color: #f8f9fa; /* Very light gray background for inputs */
    color: #495057; /* Input text color */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#starterNamesContainer input.player-name-input,
#reserveNamesContainer input.player-name-input {
    margin-bottom: 6px;
}

.form-group input[type="number"]:focus,
.form-group select:focus,
.form-group input.player-name-input:focus
{
    border-color: #80bdff; /* Blue focus border */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); /* Blue focus shadow */
    background-color: #fff;
}

.form-group.radio-group label { display: inline-block; margin-right: 15px; font-weight: normal; }
.form-group.radio-group input[type="radio"] { margin-right: 4px; vertical-align: middle; }


/* Preliminary Plan Section Styles (from previous good version) */
.preliminary-plan-section {
    margin-top: 25px;
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #007bff;
    border-radius: 8px;
    background-color: #e7f3ff;
}
#getPlanButton {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 15px;
}
#getPlanButton:hover {
    background-color: #138496;
}
#preliminaryPlanOutput {
    padding: 10px;
    background-color: #ffffff;
    border: 1px dashed #17a2b8;
    border-radius: 6px;
    min-height: 40px;
    font-size: 0.9rem;
    color: #333;
}
#preliminaryPlanOutput h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #138496;
    font-size: 1rem;
    font-weight: 600;
}
#preliminaryPlanOutput p { margin-bottom: 4px; line-height: 1.5; }
#preliminaryPlanOutput ul { list-style-type: disc; margin-left: 20px; padding-left: 0; }
#preliminaryPlanOutput li { margin-bottom: 3px; }
#preliminaryPlanOutput .error-message { color: #dc3545; font-weight: bold; }
#preliminaryPlanOutput em { color: #6c757d; }


#confirmSetupButton {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: 25px;
}
#confirmSetupButton:hover { background-color: #0056b3; transform: translateY(-1px); }
.error-message { color: #dc3545; font-weight: bold; margin-top: 10px; text-align: center; }


/* GAME CONTAINER AND INFO */
#game-container { background-color: #f8f9fa; padding: 15px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); max-width: 800px; margin: 20px auto; display: flex; flex-direction: column; gap: 15px; } /* Reduced gap slightly */
#game-header { display: flex; flex-direction: column; gap: 8px; } /* Reduced gap */
#game-info { background-color: #fff; padding: 15px 20px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.07); display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; gap: 15px; }
.info-box { text-align: center; padding: 5px 10px; flex-grow: 1; flex-basis: auto; display: flex; flex-direction: column; justify-content: center; }
.info-box h3 { margin: 0 0 4px 0; font-size: 0.85rem; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; }
.info-box p { margin: 0; font-size: 1.3rem; font-weight: 600; color: #004080; }
.timer-box { display: flex; flex-direction: column; align-items: center; flex-basis: 180px; flex-grow: 2; }
.timer-box p#gameTimer { font-size: 3rem; color: #004080; margin: 0; line-height: 1; font-weight: 700; }
.timer-box p#periodTimer { font-size: 0.9rem; color: #495057; font-weight: normal; margin: 2px 0 8px 0; }
.timer-box #startStopButton {
    padding: 10px 18px; font-size: 1rem; border-radius: 6px; margin-top: 8px; width: 130px; font-weight: 500;
}
.timer-box #startStopButton.start { background-color: #28a745; }
.timer-box #startStopButton.stop { background-color: #dc3545; }
.timer-box #startStopButton:hover { opacity: 0.85; }
.timer-box #startStopButton:active { transform: scale(0.96); }
.timer-box #startStopButton.pending-sub-warning { border: 3px solid #ffc107; box-shadow: 0 0 8px rgba(255, 193, 7, 0.5); }

.game-status-top {
    font-weight: 600; color: #007bff; min-height: 1.2em; width: 100%;
    text-align: center; margin-top: 0; margin-bottom: 0; font-size: 1rem; /* Removed bottom margin */
    padding: 8px 0; background-color: #e7f3ff; border-radius: 6px;
}

/* NEW SPONSOR BANNER FOR ACTIVE GAME SCREEN */
.screen-sponsor-banner {
    background-color: #f0f4f8; /* Very light, neutral blue/grey */
    color: #003366; /* Darker blue for text */
    padding: 6px 10px; /* More compact */
    text-align: center;
    font-size: 0.8rem; /* Smaller font */
    border-radius: 6px;
    margin: 8px auto 0 auto; /* Spacing from status message */
    max-width: 85%; /* Not full width, more subtle */
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid #dde8f0; /* Subtle border */
}
.screen-sponsor-banner a {
    color: #0056b3; /* Standard link blue */
    font-weight: 500; /* Less emphasis than main sponsor links */
    text-decoration: none;
}
.screen-sponsor-banner a:hover {
    text-decoration: underline;
}


/* ... (Halftime, NextSubBox, PlayerLists, GameControls, Modals, Media Queries - REMAINDER OF STYLES) ... */
/* Ensure the disabled button style includes #getPlanButton:disabled if not already covered by general button:disabled */
button:disabled, input[type="button"]:disabled, input[type="submit"]:disabled,
#startStopButton:disabled, #emergencySubButton:disabled, #manageGKButton:disabled,
.modal-actions button:disabled, #game-controls #resetButton:disabled, .halftime-controls button:disabled,
#nextSubBox #confirmSubButton:disabled, #getPlanButton:disabled {
    background-color: #adb5bd !important;
    border-color: #adb5bd !important;
    color: #495057 !important;
    cursor: not-allowed !important;
    opacity: 0.65 !important;
    transform: none !important;
    box-shadow: none !important;
}
#halftimeScreen { border: 3px solid #17a2b8; padding: 25px; border-radius: 10px; background-color: #e3f2fd; text-align: center; box-shadow: 0 3px 10px rgba(23, 162, 184, 0.2); }
#halftimeScreen h2 { color: #138496; margin-top: 0; margin-bottom: 15px; font-size: 1.6rem; text-transform: uppercase; }
.halftime-sponsor { font-size: 1.1rem; color: #004080; margin-bottom: 20px; }
.halftime-sponsor a { font-weight: bold; color: #0056b3; }
.halftime-controls { display: flex; justify-content: center; gap: 15px; margin-top: 20px; flex-wrap: wrap; }
.halftime-controls button { padding: 10px 20px; font-size: 1rem; border-radius: 6px; font-weight: 500; }

#nextSubBox { border: 3px solid #fd7e14; padding: 20px; border-radius: 10px; background-color: #fff3e0; text-align: center; box-shadow: 0 3px 10px rgba(253, 126, 20, 0.2); }
#nextSubBox h3 { color: #e85d04; margin-top: 0; margin-bottom: 8px; font-size: 1.25rem; text-transform: uppercase; letter-spacing: 0.5px; }
.next-sub-countdown { margin-bottom: 12px; }
#nextSubCountdown { color: #d9534f; font-size: 2.75rem; font-weight: 700; margin: 0; text-shadow: 1px 1px 2px rgba(0,0,0,0.1); }
.sub-players-container { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 18px 0; }
.sub-player-box { flex: 1; padding: 12px; border-radius: 8px; min-height: 85px; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; }
.sub-player-box h4 { margin: 0 0 8px 0; font-size: 1.05rem; text-align: center; font-weight: 600; }
#playersComingOff, #playersComingOn { font-size: 1.6rem; font-weight: bold; text-align: center; min-height: 32px; word-wrap: break-word; line-height: 1.3; }
.sub-arrows { font-size: 2rem; align-self: center; color: #555; }
.sub-message { margin: 12px 0 0 0; font-size: 0.9rem; color: #6c757d; font-style: italic; }
.pending-sub-message { font-size: 1.15rem !important; color: #d9534f !important; font-weight: bold !important; margin-top: 12px; }
#nextSubBox #confirmSubButton { background-color: #fd7e14; font-weight: 500; }

#onFieldContainer, #onBenchContainer { padding: 20px; border-radius: 10px; box-shadow: 0 3px 8px rgba(0,0,0,0.1); overflow: hidden; position: relative; }
#onFieldContainer { background-color: #d4edda; border: 2px solid #28a745; margin-bottom: 20px; }
#onFieldContainer h3 { color: #155724; border-bottom-color: rgba(39, 174, 96, 0.5); }
#onFieldContainer li { color: #155724; border-bottom-color: rgba(39, 174, 96, 0.4); }
#onFieldContainer li span { color: #155724; }
#onFieldContainer li span.player-times { color: #10431c; }
#onFieldContainer li span.player-name.is-gk { color: #0b2c13 !important; font-weight: 700 !important; }

#onBenchContainer { background-color: #f8d7da; border: 2px solid #dc3545; }
#onBenchContainer h3 { color: #721c24; border-bottom-color: rgba(220, 53, 69, 0.5); }
#onBenchContainer li { color: #721c24; border-bottom-color: rgba(220, 53, 69, 0.4); }
#onBenchContainer li span { color: #721c24; }
#onBenchContainer li span.player-times { color: #5a161c; }
#onBenchContainer li span.player-name.is-gk { color: #491217 !important; font-weight: 700 !important; }

#onFieldContainer ul, #onBenchContainer ul { list-style-type: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; position: relative; z-index: 1; }
#onFieldContainer h3, #onBenchContainer h3 { font-weight: 600; position: relative; z-index: 1; margin-top: 0; padding-bottom: 10px; text-align: center; font-size: 1.15rem;}
#onFieldContainer li, #onBenchContainer li { font-weight: 500; position: relative; z-index: 1; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; }
#onFieldContainer li:last-child, #onBenchContainer li:last-child { border-bottom: none; }
#onFieldContainer li span.player-name, #onBenchContainer li span.player-name { flex-grow: 1; margin-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#onFieldContainer li span.player-times, #onBenchContainer li span.player-times { font-size: 0.85rem; flex-shrink: 0; white-space: nowrap; }
#onFieldContainer li span.player-name.is-removed, #onBenchContainer li span.player-name.is-removed { text-decoration: line-through; font-style: italic; opacity: 0.7;}

#game-controls { text-align: center; display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 25px; }
#emergencySubButton, #manageGKButton, #game-controls #resetButton { padding: 10px 18px; font-size: 1rem; border-radius: 6px; font-weight: 500; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 15px; }
.modal-content { background-color: white; padding: 25px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-content h3 { font-size: 1.5rem; color: #004080; margin-top: 0; margin-bottom: 20px; text-align: center; }
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions button { padding: 10px 15px; font-size: 0.95rem; border-radius: 6px; font-weight: 500; }
#confirmEmergencySubButton, #confirmManageGKButton { background-color: #007bff; color:white; }
#confirmEmergencySubButton:hover, #confirmManageGKButton:hover { background-color: #0056b3; }
#cancelEmergencySubButton, #cancelManageGKButton { background-color: #6c757d; color: white; }
#cancelEmergencySubButton:hover, #cancelManageGKButton:hover { background-color: #5a6268; }
#gkPlayerList div { margin-bottom: 8px; }
#gkPlayerList label { display: flex; align-items: center; justify-content: space-between; }
#gkPlayerList input[type="checkbox"] { margin-left: 10px; transform: scale(1.2); }


@media (max-width: 768px) {
    #appHeader { padding: 8px 15px; }
    #mastheadLogo { max-height: 70px; margin-bottom: 5px; }
    #topSponsorBanner { font-size: 0.9rem; padding: 8px 10px; } /* Adjusted for consistency */
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.15rem; }

    #setup { padding: 20px; max-width: 95%; margin: 20px auto; }
    .form-group input[type="number"],
    .form-group select,
    .form-group input.player-name-input { padding: 10px; }

    .preliminary-plan-section { padding: 12px; }
    #getPlanButton { font-size: 0.95rem; padding: 9px 12px; }
    #preliminaryPlanOutput { font-size: 0.85rem; padding: 8px; }

    #game-container { padding: 10px; gap: 12px; max-width: 95%; } /* Adjusted gap */
    #game-info { padding: 10px; gap: 10px; flex-direction: column; }
    .info-box { flex-basis: 100%; }
    .timer-box { order: -1; padding-bottom: 10px; margin-bottom: 10px; width: 100%; }
    .timer-box p#gameTimer { font-size: 2.5rem; }
    .timer-box p#periodTimer { font-size: 0.85rem; }
    .timer-box #startStopButton { width: 110px; padding: 9px 15px; font-size: 0.95rem; }
    .game-status-top { font-size: 0.9rem; padding: 6px 0; }
    .screen-sponsor-banner { font-size: 0.75rem; padding: 5px 8px; max-width: 90%; margin-top: 6px;}


    #halftimeScreen { padding: 20px; } #halftimeScreen h2 { font-size: 1.4rem; }
    #nextSubBox { padding: 15px; } #nextSubBox h3 { font-size: 1.15rem; }
    #nextSubCountdown { font-size: 2.25rem; }
    .sub-player-box { min-height: 75px; padding: 10px; }
    #playersComingOff, #playersComingOn { font-size: 1.3rem; }
    .sub-arrows { font-size: 1.7rem; }
    #nextSubBox #confirmSubButton { font-size: 1.1rem; padding: 10px; }

    #onFieldContainer, #onBenchContainer { padding: 15px; }
    #onFieldContainer h3, #onBenchContainer h3 { font-size: 1.05rem; }
    #onFieldContainer li, #onBenchContainer li { padding: 7px 8px; }
    #onFieldContainer li span.player-times, #onBenchContainer li span.player-times { font-size: 0.8rem; }

    #game-controls { gap: 10px; margin-top: 20px;}
    #game-controls button { font-size: 0.9rem; min-width: 100px; padding: 9px 15px; }
    .modal-content { padding: 20px; max-height: 85vh; }
    .modal-content h3 { font-size: 1.3rem; }
    .modal-actions button { font-size: 0.9rem; }
}

@media (max-width: 480px) {
    #mastheadLogo { max-height: 60px; }
    #topSponsorBanner { font-size: 0.8rem; } /* Adjusted */
    h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } .small-note { font-size: 0.8rem;}
    #setup { padding: 15px; }
    #confirmSetupButton { font-size: 1rem; padding: 10px 15px;}
    .form-group input[type="number"],
    .form-group select,
    .form-group input.player-name-input { padding: 9px 12px; font-size: 0.95rem; }

    #getPlanButton { font-size: 0.9rem; }
    #preliminaryPlanOutput { font-size: 0.8rem; }
    .screen-sponsor-banner { font-size: 0.7rem; padding: 4px 6px;}


    .timer-box p#gameTimer { font-size: 2.2rem; }
    .timer-box p#periodTimer { font-size: 0.8rem; }
    .info-box p { font-size: 1.1rem; }
    .game-status-top { font-size: 0.85rem; }

    #nextSubCountdown { font-size: 2rem; }
    #playersComingOff, #playersComingOn { font-size: 1.1rem; }
    #nextSubBox #confirmSubButton { font-size: 1rem; padding: 9px; }

    #onFieldContainer h3, #onBenchContainer h3 { font-size: 1rem; }
    #onFieldContainer li span.player-times, #onBenchContainer li span.player-times { font-size: 0.75rem; }
     #game-controls button { font-size: 0.85rem; min-width: 90px; padding: 8px 12px; }

    .modal-content h3 { font-size: 1.2rem; }
}

.hidden { display: none !important; }