:root {
    --background-color-light: #fff;
    --text-color-light: #222;
    --button-background-light: #4CAF50;
    --button-text-light: white;

    --background-color-dark: #222;
    --text-color-dark: #fff;
    --button-background-dark: #4CAF50;
    --button-text-dark: white;
}

body {
    font-family: sans-serif;
    background-color: var(--background-color-light);
    color: var(--text-color-light);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: var(--background-color-dark);
    color: var(--text-color-dark);
}

.container {
    text-align: center;
    /* Adjust container to allow inline elements next to h1 */
    position: relative;
    padding-top: 20px; /* Add some padding for the new elements */
}

h1 {
    display: inline-block; /* Allow other elements next to it */
    margin-right: 10px; /* Space between title and controls */
}

.login-signup-controls {
    display: inline-flex; /* Align items inside and allow group next to h1 */
    align-items: center;
    gap: 5px;
    font-size: 0.8em; /* Small text */
    vertical-align: middle; /* Align with middle of h1 */
}

.login-signup-controls input[type="text"],
.login-signup-controls input[type="password"] {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 0.9em;
    background-color: var(--background-color-light);
    color: var(--text-color-light);
}

body.dark-mode .login-signup-controls input[type="text"],
body.dark-mode .login-signup-controls input[type="password"] {
    background-color: #444;
    color: var(--text-color-dark);
    border-color: #666;
}

#signup-button {
    background-color: #007bff; /* Blue for signup */
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    border: none;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s;
}

#signup-button:hover {
    background-color: #0056b3;
}

body.dark-mode #signup-button {
    background-color: #1a73e8; /* Slightly different blue for dark mode */
}

body.dark-mode #signup-button:hover {
    background-color: #0d47a1;
}

.lotto-number {
    font-size: 3rem;
    margin: 20px 0;
    padding: 10px 0; /* Add some vertical padding */
}

.lotto-display-wrapper {
    display: inline-block; /* To make background apply only to content width */
    padding: 10px 15px;
    border-radius: 8px;
    background-color: #f0f0f0; /* Light mode background */
    color: var(--text-color-light); /* Light mode text color */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    min-width: 250px; /* Ensure sufficient width for group + number */
    text-align: center;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

body.dark-mode .lotto-display-wrapper {
    background-color: #333; /* Dark mode background */
    color: var(--text-color-dark); /* Dark mode text color */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

body.dark-mode #draw-button, body.dark-mode #theme-toggle, body.dark-mode #draw-5-button {
    background-color: var(--button-background-dark);
    color: var(--button-text-dark);
}

/* Ensure contact button in dark mode retains light mode style */
body.dark-mode a button {
    background-color: var(--button-background-light);
    color: var(--button-text-light);
}

body.dark-mode a button:hover {
    background-color: #3e8e41; /* Darker green for hover in dark mode */
}


/* New styles for button groups */
#draw-buttons-group, #utility-buttons-group {
    display: flex;
    justify-content: center;
    gap: 10px; /* Space between buttons */
    margin-top: 20px;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

#utility-buttons-group button, #utility-buttons-group a button {
    flex-basis: 150px; /* Give a fixed width to ensure consistency, adjust as needed */
    max-width: 180px;
    /* Remove individual button margins, handled by gap */
    margin: 0;
}

#draw-button, #theme-toggle, #draw-5-button, a button {
    background-color: var(--button-background-light);
    color: var(--button-text-light);
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    transition: background-color 0.3s;
}

/* Styles for the draw history section */
#draw-history {
    max-width: 600px;
    width: 100%;
    margin-top: 40px;
    /* text-align: center; Removed to allow button to float right */
}

#draw-history h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center; /* Center the text part of the heading */
}

#clear-history-button {
    background-color: #f44336; /* Red color for a clear action */
    color: white;
    padding: 8px 15px;
    font-size: 0.8em;
    cursor: pointer;
    border-radius: 5px;
    border: none;
    transition: background-color 0.3s;
    margin-left: auto; /* Push button to the right */
}

#clear-history-button:hover {
    background-color: #d32f2f;
}

#history-list {
    list-style: none; /* Remove default list bullets */
    padding: 0;
    margin-top: 20px;
    max-height: 300px; /* Limit height for scrollability */
    overflow-y: auto; /* Add scroll for overflowing content */
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    text-align: left; /* Align list items to left */
}

body.dark-mode #history-list {
    border: 1px solid #555;
    background-color: rgba(0, 0, 0, 0.1);
}

#history-list li {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

body.dark-mode #history-list li {
    border-bottom: 1px solid #444;
}

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

#history-list li span {
    font-weight: bold;
    color: #4CAF50; /* A distinct color for drawn numbers in history */
}

body.dark-mode #history-list li span {
    color: #8bc34a; /* Lighter green for dark mode */
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
}

form label {
    align-self: flex-start;
    margin-bottom: -5px;
}

form input[type="text"],
form input[type="email"],
form textarea {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 100%;
    box-sizing: border-box; /* Ensures padding doesn't increase total width */
    background-color: var(--background-color-light); /* Inherit from theme */
    color: var(--text-color-light); /* Inherit from theme */
}

body.dark-mode form input[type="text"],
body.dark-mode form input[type="email"],
body.dark-mode form textarea {
    background-color: var(--background-color-dark);
    color: var(--text-color-dark);
    border: 1px solid #555;
}

form button[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

form button[type="submit"]:hover {
    background-color: #0056b3;
}

/* New styles for content-box */
.content-box {
    background-color: rgba(0, 0, 0, 0.05); /* Light transparent background */
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    text-align: left;
    line-height: 1.6;
    color: var(--text-color-light); /* Default to light mode text color */
}

body.dark-mode .content-box {
    background-color: rgba(255, 255, 255, 0.05); /* Dark transparent background */
    color: var(--text-color-dark); /* Dark mode text color */
}

.content-box h3 {
    margin-top: 20px;
    border-bottom: 1px solid var(--text-color-light);
    padding-bottom: 5px;
}

body.dark-mode .content-box h3 {
    border-bottom: 1px solid var(--text-color-dark);
}

.content-box ul {
    list-style-type: disc;
    margin-left: 20px;
    padding-left: 0;
}

.content-box a {
    color: #007bff;
    text-decoration: none;
}

.content-box a:hover {
    text-decoration: underline;
}


/* New styles for footer */
footer {
    width: 100%;
    padding: 20px 0;
    text-align: center;
    background-color: var(--background-color-light);
    color: var(--text-color-light);
    border-top: 1px solid #eee;
    position: relative; /* Change to relative to not overlap content */
    bottom: 0;
    left: 0;
    margin-top: 40px; /* Add some space above the footer */
    flex-shrink: 0; /* Prevent footer from shrinking */
}

body.dark-mode footer {
    background-color: var(--background-color-dark);
    color: var(--text-color-dark);
    border-top: 1px solid #333;
}

footer nav a {
    color: var(--text-color-light);
    text-decoration: none;
    margin: 0 10px;
    font-weight: bold;
}

body.dark-mode footer nav a {
    color: var(--text-color-dark);
}

footer nav a:hover {
    text-decoration: underline;
}

footer p {
    margin-top: 10px;
    font-size: 0.9em;
}

/* Adjust body for footer */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.container {
    flex-grow: 1; /* Allow container to grow and push footer down */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 50px; /* Space for content above footer */
}
