/* --- Root Variables for Themes --- */
:root {
    /* Light Mode Colors (Default) */
    --background-color: #f8f8f8;
    --container-bg-color: #ffffff;
    --text-color: #333;
    --heading-color: #333;
    --quote-display-bg: #fdfdfd;
    --quote-display-border: #ddd;
    --input-border: #dfe1e5;
    --input-shadow: rgba(0, 0, 0, 0.1);
    --input-focus-border: #4285f4;
    --input-focus-shadow: rgba(66, 133, 244, 0.2);
    --results-color: #333;
    --correct-color: green;
    --incorrect-color: red;
    --button-bg-color: #4285f4;
    --button-text-color: #ffffff;
}

/* Dark Mode Colors */
body.dark-mode {
    --background-color: #282c34; /* Dark charcoal */
    --container-bg-color: #3a3f4a; /* Slightly lighter dark */
    --text-color: #e0e0e0; /* Light gray text */
    --heading-color: #f0f0f0; /* Lighter heading */
    --quote-display-bg: #4a505c; /* Darker background for quote */
    --quote-display-border: #5a606c; /* Darker border */
    --input-border: #5a606c;
    --input-shadow: rgba(0, 0, 0, 0.3);
    --input-focus-border: #8ab4f8; /* Lighter blue for dark mode focus */
    --input-focus-shadow: rgba(138, 180, 248, 0.3);
    --results-color: #e0e0e0;
    --correct-color: #8aff8a; /* Lighter green */
    --incorrect-color: #ff8a8a; /* Lighter red */
    --button-bg-color: #8ab4f8; /* Lighter blue for button */
    --button-text-color: #282c34;
}

/* --- Global Transitions for Smooth Mode Change --- */
body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: var(--background-color); /* Use variable */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
}

.container {
    text-align: center;
    background-color: var(--container-bg-color); /* Use variable */
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 90%;
    transition: background-color 0.3s ease, box-shadow 0.3s ease; /* Smooth transition */
}

h1 {
    color: var(--heading-color); /* Use variable */
    margin-bottom: 30px;
    transition: color 0.3s ease;
}

#quoteDisplay {
    font-size: 1.5em;
    margin-bottom: 25px;
    line-height: 1.6;
    color: var(--text-color); /* Use variable */
    text-align: left;
    padding: 10px;
    border: 1px solid var(--quote-display-border); /* Use variable */
    background-color: var(--quote-display-bg); /* Use variable */
    border-radius: 4px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;

    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}


#quoteInput {
    width: calc(100% - 20px);
    padding: 15px;
    font-size: 1.2em;
    border: 1px solid var(--input-border); /* Use variable */
    border-radius: 24px;
    box-shadow: 0 2px 5px var(--input-shadow); /* Use variable */
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    text-align: center;
    color: var(--text-color); /* Ensure input text color also changes */
    background-color: var(--container-bg-color); /* Input background matching container */
}

#quoteInput:focus {
    border-color: var(--input-focus-border); /* Use variable */
    box-shadow: 0 2px 8px var(--input-focus-shadow); /* Use variable */
}

#results {
    margin-top: 25px;
    font-size: 1.2em;
    color: var(--results-color); /* Use variable */
    min-height: 30px;
    transition: color 0.3s ease;
}

#results button {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    background-color: var(--button-bg-color); /* Use variable */
    color: var(--button-text-color); /* Use variable */
    transition: background-color 0.3s ease, color 0.3s ease;
}

#results button:hover {
    opacity: 0.9;
}

.correct {
    color: var(--correct-color); /* Use variable */
}

.incorrect {
    color: var(--incorrect-color); /* Use variable */
    text-decoration: underline;
}

/* --- New: Theme Toggle Button Styling --- */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--button-bg-color);
    color: var(--button-text-color);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    z-index: 1000;
}
.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
}
.theme-toggle:active {
    transform: scale(0.95);
}

/* Ensure the fill="currentColor" attribute on SVGs in HTML works */
/* The .theme-toggle's color property will be inherited by the SVG */
.theme-toggle {
    /* ... (existing theme-toggle styles) ... */
    color: var(--button-text-color); /* This color will be inherited by the SVG fill="currentColor" */
}

/* --- New: Mode Selection Buttons Styling --- */
.mode-selection {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    gap: 10px; /* Space between buttons */
}

.mode-button {
    padding: 10px 20px;
    font-size: 1em;
    border: 1px solid var(--input-border);
    border-radius: 20px;
    cursor: pointer;
    background-color: var(--container-bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.mode-button:hover {
    background-color: var(--input-focus-border);
    color: var(--button-text-color);
}

.mode-button.active {
    background-color: var(--button-bg-color);
    color: var(--button-text-color);
    border-color: var(--button-bg-color);
}

/* Ensure #quoteDisplay and #quoteInput also transition colors nicely */
#quoteDisplay, #quoteInput {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Style for the Enter symbol in free typing preview */
.enter-symbol {
    color: #999; /* A lighter gray */
    font-size: 0.8em; /* Slightly smaller */
    margin: 0 2px; /* Small horizontal spacing */
    opacity: 0.7; /* Make it a bit transparent */
}
