/* General page styling */
body {
    font-family: Arial, sans-serif;
    background-color: #228B22; /* Green background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

/* Container for the timer and controls */
.container {
    background-color: #ffffff; /* White background for content */
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); /* Subtle shadow effect */
    text-align: center;
    width: 300px;
}

/* Heading style */
h1 {
    font-size: 24px;
    color: #444;
    margin-bottom: 20px;
}

/* Timer styling */
#timer-box {
    color: white;
    border-radius: 10px;
    padding: 20px 40px;
    margin-bottom: 20px;
    width: auto; /* Let the width adjust to content */
    height: 150px; /* Explicit height for normal mode */
    border: 1px solid black;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #4CAF50;
    transition: background-color 0.1s ease;
    position: relative; /* Required for absolute positioning of child elements */
}

/* Timer text styling */
#timer {
    font-size: 150px; /* Original size for normal mode */
    transition: font-size 0.3s ease; /* Smooth transition for font size changes */
}

/* Default font size for the timer */
#timer {
    font-size: 150px; /* Original size for normal mode */
    transition: font-size 0.3s ease; /* Smooth transition for font size changes */
}

/* Button styling */
#buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

button {
    padding: 20px;
    width: 100px;
    font-size: 18px;
    border: 1px solid black; /* Thin black outline for all buttons */
    border-radius: 10px; /* More rounded corners */
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

#start-pause-button {
    background-color: #4CAF50; /* Start button green */
    color: white;
}

#reset-button {
    background-color: #FF9800; /* Reset button orange */
    color: white;
}

#stop-button {
    background-color: #f44336; /* Stop button red */
    color: white;
}

/* Settings button styling */
#settings-button, #rules-button {
    background-color: #19818c;
    color: white;
    margin-bottom: 20px;
    padding: 10px 20px; /* Reduced padding: 5px for top/bottom, 20px for left/right */
}

/* Match timer styling */
#match-timer-box {
    background-color: #444; /* Dark background for match timer */
    color: white;
    border-radius: 10px;
    padding: 10px;
    font-size: 20px;
}

/* Extension buttons container */
#extension-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    margin-bottom: 20px; /* Space between match timer and winner/loser buttons */
}

/* Extension button styling */
.extension-button {
    padding: 15px;
    width: 100px;
    font-size: 18px;
    border: 1px solid black; /* Thin black outline for extension buttons */
    border-radius: 50%; /* Makes the extension box circular */
    width: 80px; /* Set the width of the circle */
    height: 80px; /* Set the height of the circle */
    margin-left: 10px;
    margin-right: 10px;
    display: flex;
    justify-content: center; /* Center the ext. inside the circle */
    align-items: center; /* Center the ext. inside the circle */
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

#ext-red-button {
    background-color: #f44336; /* Red */
    color: white;
}

#ext-yellow-button {
    background-color: #ffe600; /* Yellow */
    color: black;
}

.extension-button:disabled {
    background-color: #ccc; /* Greyed-out color when disabled */
    cursor: not-allowed;
}

/* Match timer and other button styles remain unchanged */

/* New button styling for Winner and Loser */
#end-game-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
}

#winner-button, #loser-button {
    padding: 10px 20px; /* Reduce padding for height adjustment */
    font-size: 16px; /* Smaller font size */
    border: 1px solid black; /* Thin black outline for winner/loser buttons */
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

#winner-button {
    background-color: #4CAF50; /* Blue for Winner */
    color: white;
}

#loser-button {
    background-color: #f44336; /* Red for Loser */
    color: white;
}

button:hover {
    opacity: 0.9;
}

/* "Created by" text inside the container */
.created-by {
    margin-top: 20px; /* Adds some space above */
    color: black; /* Black text */
    font-size: 14px; /* Size of the text */
    text-align: center; /* Center-align the text */
    display: inline-block; /* Ensures it stays on a single line */
}

/* Full Screen Button Styling with Icon */
#fullscreen-button {
    background-color: transparent; /* Transparent background */
    color: white; /* Icon color */
    padding: 8px; /* Smaller padding for an icon button */
    font-size: 16px; /* Adjust icon size */
    border: none; /* Remove border */
    border-radius: 5px; /* Slightly rounded corners */
    cursor: pointer;
    width: 40px; /* Fixed width for the icon button */
    height: 40px; /* Fixed height for the icon button */
    display: flex; /* Center the icon */
    justify-content: center; /* Center the icon horizontally */
    align-items: center; /* Center the icon vertically */
    position: absolute; /* Position the button absolutely within the timer box */
    bottom: 10px; /* Position from the bottom */
    right: 10px; /* Position from the right */
}

/* Hover effect for the button */
#fullscreen-button:hover {
    opacity: 0.8; /* Slightly transparent on hover */
}

/* Ensure the timer box has relative positioning for absolute child elements */
#timer-box {
    position: relative; /* Required for absolute positioning of child elements */
}

/* Full-screen pause/resume button styling */
#fullscreen-pause-button {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: 20px; /* Position at the bottom */
    left: 20px; /* Position at the left */
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    color: white;
    border: none;
    border-radius: 50%; /* Makes the button circular */
    width: 80px; /* Fixed width */
    height: 80px; /* Fixed height */
    font-size: 40px; /* Icon size */
    cursor: pointer;
    z-index: 1000; /* Ensure it's above other elements */
    display: none; /* Use flexbox for centering */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    transition: background-color 0.2s ease-in-out; /* Smooth hover effect */
}

#fullscreen-pause-button:hover {
    background-color: rgba(0, 0, 0, 0.7); /* Darker on hover */
}

/* Show the button in full-screen mode */
#timer-box:fullscreen #fullscreen-pause-button,
#timer-box:-webkit-full-screen #fullscreen-pause-button,
#timer-box:-moz-full-screen #fullscreen-pause-button,
#timer-box:-ms-fullscreen #fullscreen-pause-button {
    display: block !important; /* Force the button to be visible */
}

/* Position the button in portrait mode */
@media (orientation: portrait) {
    #fullscreen-pause-button {
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%); /* Center horizontally */
    }
}

/* Position the button in landscape mode */
@media (orientation: landscape) {
    #fullscreen-pause-button {
        bottom: 20px;
        left: 20px;
    }
}

/* Full-screen mode styling */
#timer-box:fullscreen,
#timer-box:-webkit-full-screen,
#timer-box:-moz-full-screen {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #4CAF50; /* Ensure the background color is consistent */
}

/* Settings Popup */
.popup {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border: 2px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    text-align: center;
}

.settings-popup {
    padding: 20px;
    background-color: #f0f0f0;
    border-radius: 8px;
    width: 300px;
    position: relative;
}

.settings-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.settings-section label {
    flex-basis: 60%;
    text-align: left;
}

.settings-section input[type="color"],
.settings-section input[type="number"] {
    flex-basis: 35%;
}

.settings-buttons {
    text-align: right;
    margin-top: 20px;
}

.settings-buttons button {
    margin-left: 10px;
}

.popup h2 {
    font-size: 22px;
    margin-bottom: 10px;
}

.popup-buttons {
    margin-top: 20px;
}

.popup-buttons button {
    padding: 10px 20px;
}

/* Full-screen mode with safe zone */
#timer-box.fullscreen-safe-zone {
    padding: 50px; /* Add padding to create a safe zone */
    box-sizing: border-box; /* Ensure padding is included in the element's dimensions */
}

/* Ensure the timer text is centered within the safe zone */
#timer-box.fullscreen-safe-zone #timer {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}