/* css/style.css */

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Define theme colors - easy to change later */
    --primary-color: #4a90e2; /* A nice blue */
    --secondary-color: #50e3c2; /* A teal/aqua */
    --background-color: #f4f7f6; /* Light off-white */
    --text-color: #333;
    --light-text-color: #fff;
    --border-color: #ccc;
    --success-color: #4CAF50;
    --fail-color: #F44336;
    --disabled-opacity: 0.6;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --base-font-size: 16px;
    --border-radius: 5px;
    --transition-speed: 0.3s;
}

html {
    font-size: var(--base-font-size);
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    background-color: var(--background-color); /* Fallback */
    background-image: url('../assets/images/background.jpg'); /* Reference asset */
    background-size: cover;
    background-position: center center;
    background-attachment: fixed; /* Keeps background static during scroll */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.6;
}

/* --- Logo & Title --- */
.logo-container {
    margin-bottom: 10px;
}

#logo {
    max-height: 80px; /* Adjust as needed */
    width: auto;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

h2, h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

/* --- Content Wrapper & Screens --- */
#content-wrapper {
    background-color: rgba(255, 255, 255, 0.9); /* Semi-transparent white background */
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px; /* Max width for content */
    position: relative; /* Needed for potential absolute positioning within */
    /* overflow: hidden; */ /* Let's remove this for now, might clip modal */
}

/* Generic hidden rule - use display:none for reliable hiding */
.hidden {
    display: none !important;
}

/* Base style for elements intended as 'screens' (if needed for structure) */
.screen {
     /* Add common screen padding or margins here if desired */
     /* Example: margin-bottom: 20px; */
}


/* Specific screen styling */
#loading-screen {
    text-align: center;
    font-size: 1.2em;
    color: var(--primary-color);
    padding: 40px 0; /* Add some padding */
}

#main-menu, #waiting-for-opponent, #game-over-screen {
    display: flex; /* Use flex when NOT hidden */
    flex-direction: column;
    align-items: center;
}

/* Add display: flex back to non-hidden screens if needed */
/* Example: */
/* #main-menu:not(.hidden) { display: flex; } */


#category-selection {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#category-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

#game-screen {
    /* Game screen specific styles if needed */
    /* border: none; */ /* Removed previous border */
    /* padding: 0; */ /* Removed previous padding */
    min-width: auto;
    text-align: center;
}

#game-screen:not(.hidden) {
    display: block; /* Or flex, depending on internal layout */
}

#player-info {
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
    padding: 10px;
    background-color: #eef;
    border-radius: var(--border-radius);
}

.life-counter {
    display: inline-block;
    transition: transform 0.2s ease-out, color 0.2s ease-out;
}
.life-gain {
    transform: scale(1.4);
    color: var(--success-color);
}
.life-loss {
    transform: scale(0.8);
    color: var(--fail-color);
}


#game-status {
    margin-bottom: 15px;
    font-style: italic;
    color: #555;
}

#timer {
    color: var(--fail-color);
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 20px;
}
#timer.hidden { /* Ensure timer hidden rule works */
    display: none;
}

.phase-container {
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    background-color: #fff;
}
.phase-container.hidden { /* Ensure phase hidden rule works */
     display: none !important;
}

/* --- Buttons --- */
button {
    display: inline-block;
    padding: 12px 25px;
    margin: 8px;
    font-size: 1rem;
    font-weight: bold;
    color: var(--light-text-color);
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease, opacity var(--transition-speed) ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Specific button types */
#find-match-btn, #practice-btn {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

#cancel-matchmaking-btn, #forfeit-btn {
    background-color: var(--fail-color);
}

#next-round-btn {
    background-color: var(--success-color);
}
#next-round-btn.hidden { /* Ensure hidden rule works */
     display: none !important;
}


.settings-trigger, #close-settings-btn, #back-to-menu-btn {
    background-color: #aaa;
}

/* Options Container Buttons */
.options-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.options-container button {
    min-width: 100px;
    flex-basis: 40%;
    padding: 15px 10px;
    font-size: 1.1rem;
    background-color: #e9e9e9;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Hover & Active States (only if effects enabled) */
.effects-enabled button:not(:disabled):hover { /* Target non-disabled buttons */
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.effects-enabled .options-container button:not(:disabled):hover {
     background-color: #dcdcdc;
     border-color: #bbb;
     transform: translateY(-2px);
}

button:active {
    transform: translateY(0px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Disabled state */
button:disabled {
    opacity: var(--disabled-opacity);
    cursor: not-allowed;
    background-color: #ccc !important; /* Use important if needed to override specifics */
    box-shadow: none;
    transform: none;
}
.options-container button:disabled {
    background-color: #e0e0e0 !important;
    opacity: var(--disabled-opacity);
    cursor: not-allowed;
}
.options-container button:disabled:hover {
     background-color: #e0e0e0 !important; /* Keep disabled style on hover */
     transform: none;
}


/* --- Reveal Phase Styling --- */
#reveal-info p {
    margin: 8px 0;
    font-size: 1.1em;
    padding: 5px;
    border-radius: var(--border-radius);
}

#reveal-info .result-correct {
    color: var(--success-color);
    font-weight: bold;
}
.effects-enabled #reveal-info .result-correct { /* Animation only if enabled */
    animation: pulse 0.6s ease-in-out;
}

#reveal-info .result-wrong {
    color: var(--fail-color);
    font-weight: bold;
}
.effects-enabled #reveal-info .result-wrong { /* Animation only if enabled */
    animation: shake 0.5s ease-in-out;
}

/* --- Settings Modal --- */
#settings-menu {
    /* NOTE: uses the generic .hidden rule defined earlier */
    position: fixed; /* Fixed position overlay */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000; /* Make sure it's on top */
    min-width: 300px;
    text-align: center;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out; /* Optional fade for modal */
}
#settings-menu.hidden { /* Add transition state for modal if desired */
     opacity: 0;
     pointer-events: none;
     transform: translate(-50%, -45%); /* Slight move up when hidden */
}

#settings-menu label {
    display: block;
    margin-bottom: 15px;
    font-weight: bold;
}
#settings-menu input[type="range"],
#settings-menu input[type="checkbox"] {
    margin-left: 10px;
    vertical-align: middle;
}


/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% {transform: translateX(0);}
  25% {transform: translateX(-5px);}
  50% {transform: translateX(5px);}
  75% {transform: translateX(-5px);}
}

/* Apply fade-in to phase containers when effects are on */
.effects-enabled .phase-container {
    /* animation: fadeIn 0.5s ease-out forwards; */ /* Animation can conflict with display:none */
}
.effects-disabled .phase-container {
     /* animation: none; */
}


/* --- Responsive --- */
@media (max-width: 650px) {
    #content-wrapper {
        padding: 20px;
        margin: 10px 5px; /* Reduce side margin */
    }
    h1 {
        font-size: 1.8rem;
    }
    .options-container {
        flex-direction: column;
        align-items: center;
        gap: 10px; /* Reduce gap */
    }
    .options-container button {
        width: 90%; /* Make buttons wider */
        flex-basis: auto;
    }
    button {
        padding: 10px 20px; /* Slightly smaller padding */
    }
    /* css/style.css */

/* --- Life Bars --- */
#life-bars {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 650px; /* Slightly wider than content wrapper */
    margin-top: 20px;
    padding: 0 15px;
    gap: 20px;
}
#life-bars.hidden { /* Ensure hidden rule applies */
    display: none !important;
}

.life-bar-container {
    flex-basis: 48%; /* Adjust as needed */
    text-align: center;
    background-color: rgba(230, 230, 230, 0.8);
    padding: 10px;
    border-radius: var(--border-radius);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.life-label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

progress[value] {
    /* Reset the default appearance */
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;

    width: 100%;
    height: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden; /* Ensure progress stays within bounds */
    background-color: #ddd; /* Background of the empty part */
}

/* Webkit (Chrome, Safari) styles for the progress bar value */
progress[value]::-webkit-progress-bar {
    background-color: #ddd;
    border-radius: var(--border-radius);
}
progress[value]::-webkit-progress-value {
    background-color: var(--success-color); /* Default green */
    border-radius: 0; /* Smooth fill */
    transition: width 0.3s ease-out, background-color 0.3s ease-out; /* Animate width change */
}

/* Mozilla Firefox styles for the progress bar value */
progress[value]::-moz-progress-bar {
    background-color: var(--success-color); /* Default green */
    border-radius: 0;
    transition: width 0.3s ease-out, background-color 0.3s ease-out;
}

/* Style the bar color based on value (example thresholds) */
progress[value="10"], progress[value="9"], progress[value="8"], progress[value="7"] { /* High life */ }
progress[value="6"]::-webkit-progress-value, progress[value="6"]::-moz-progress-bar,
progress[value="5"]::-webkit-progress-value, progress[value="5"]::-moz-progress-bar,
progress[value="4"]::-webkit-progress-value, progress[value="4"]::-moz-progress-bar { /* Mid life */
    background-color: #ffae42; /* Orange */
}
progress[value="3"]::-webkit-progress-value, progress[value="3"]::-moz-progress-bar,
progress[value="2"]::-webkit-progress-value, progress[value="2"]::-moz-progress-bar,
progress[value="1"]::-webkit-progress-value, progress[value="1"]::-moz-progress-bar { /* Low life */
    background-color: var(--fail-color); /* Red */
}
progress[value="0"]::-webkit-progress-value, progress[value="0"]::-moz-progress-bar { /* Zero life */
     background-color: #555; /* Dark grey / Empty */
}

.life-text {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
}

/* Ensure opponent bar is styled similarly if needed */
.player2-bar {
    /* Any specific opponent styles? Maybe different label? */
}

/* Responsive for life bars */
@media (max-width: 650px) {
    #life-bars {
        flex-direction: column;
        gap: 10px;
        max-width: 95%;
    }
    .life-bar-container {
        flex-basis: auto;
    }
}
}   