/* roulette.css */

:root {
    /* Dark Theme Colors */
    --background-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-background: #2c2c2c;
    --border-color: #444;
    --input-background: #3a3a3a;
    --button-background: #007bff; /* A nice blue for actions */
    --button-hover: #0056b3;
    --confirm-button-danger: #dc3545;
    --confirm-button-danger-hover: #c82333;

    /* Roulette Colors */
    --red: #dc3545;
    --black: #343a40;
    --green: #28a745;
    --table-felt: #004d40;

    /* Highlight for "due" items */
    --highlight: #555555;
    --highlight-text: #f8d7da;
}

/* Base Styles */
body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 100px; /* Space for the fixed corner buttons */
}

.container {
    max-width: 1200px;
    margin: 25px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 25px; /* Maintain consistent spacing between sections */
    flex-grow: 1;
    position: relative; /* Added: To allow absolute positioning of child elements like the settings button */
}

h1 {
    text-align: center;
    color: var(--green);
    margin-bottom: 25px;
    font-size: 2.5em;
    letter-spacing: 1.5px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
}

h3 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    font-size: 1.3em;
    display: flex; /* Make h3 a flex container */
    justify-content: space-between; /* Space out title and actions */
    align-items: center;
}

button {
    padding: 12px 20px;
    cursor: pointer;
    background-color: var(--button-background);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: bold;
    transition: background-color 0.3s ease-in-out, transform 0.1s ease, box-shadow 0.3s ease;
}

button:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Icon Buttons within history header */
.history-actions {
    display: flex;
    gap: 10px;
    margin-left: auto; /* Push buttons to the right */
}

.icon-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.4em;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px; /* Fixed width/height for consistent icon size */
    height: 35px;
}

.icon-button:hover {
    color: var(--button-background);
    background-color: rgba(255, 255, 255, 0.1);
    transform: none; /* Override general button hover transform */
    box-shadow: none; /* Override general button hover shadow */
}

.icon-button:active {
    transform: none;
}

/* History Grid */
.history {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.history h3 {
    border-bottom: none;
    padding-bottom: 0;
}

.grid { /* Used for history items */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 8px;
    margin-top: 15px;
}

.number-item { /* Used for history items and suggested numbers */
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    font-size: 1em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    color: white;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column on small screens */
    gap: 25px;
}

.stat-card {
    background: var(--card-background);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.stat-card h3 {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px; /* Slightly reduced margin for better fit if many rows */
    padding-bottom: 8px;
    justify-content: flex-start; /* Reset for stat card h3 */
}

.scrollable {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
}

.scrollable::-webkit-scrollbar {
    width: 10px;
}
.scrollable::-webkit-scrollbar-track {
    background: var(--input-background);
    border-radius: 10px;
}
.scrollable::-webkit-scrollbar-thumb {
    background-color: var(--button-background);
    border-radius: 10px;
    border: 3px solid var(--input-background);
}
.scrollable::-webkit-scrollbar-thumb:hover {
    background-color: var(--button-hover);
}

/* Tables */
table {
    width: 100%;
    margin-top: 0;
    font-size: 1em;
    border-collapse: collapse;
    color: var(--text-color);
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--input-background);
    font-weight: bold;
    color: var(--text-color);
    position: sticky;
    top: -8px;
    z-index: 1;
}

tbody tr:last-child td {
    border-bottom: none;
}

.highlight {
    background-color: var(--highlight);
    color: var(--highlight-text);
    font-weight: bold;
}

/* Probabilistic Section - MODIFIED STYLES */
.probabilistic-section {
    /* This will now span all columns within the stats-section grid */
    grid-column: 1 / -1; /* Spans from the first column line to the last */
    /* Remove any explicit width/max-width set previously, it inherits from the grid */
}

.suggested-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.suggested-numbers .number-item {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.1em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.suggested-row-column div {
    margin: 10px 0;
    padding: 10px;
    background: var(--input-background);
    border-radius: 8px;
    font-weight: normal;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.suggestion-item {
    background-color: var(--button-background);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    margin-left: 10px;
    display: inline-block;
    font-size: 1em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.no-suggestion {
    color: #b0b0b0;
    font-style: italic;
    margin-left: 8px;
}

/* Custom Message Box for alerts / Confirmation Dialogs */
.message-box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.message-box-content {
    background-color: var(--card-background);
    color: var(--text-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    text-align: center;
    max-width: 350px;
}
.message-box-content p {
    margin-bottom: 25px;
    font-size: 1.2em;
}
.message-box-close {
    background-color: var(--button-background);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.2s ease;
}
.message-box-close:hover {
    background-color: var(--button-hover);
}

.message-box .button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Specific styles for confirmation dialog buttons */
#confirmClearYes {
    background-color: var(--confirm-button-danger);
}
#confirmClearYes:hover {
    background-color: var(--confirm-button-danger-hover);
}
#confirmClearNo {
    background-color: var(--button-background);
}
#confirmClearNo:hover {
    background-color: var(--button-hover);
}


/* Settings Overlay */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500; /* Between roulette table and alerts */
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.settings-overlay.show {
    visibility: visible;
    opacity: 1;
}

.settings-container {
    position: relative;
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
    max-width: 400px;
    width: 90vw;
    text-align: center;
    color: var(--text-color);
}

.settings-container h2 {
    font-size: 2em;
    color: var(--green);
    margin-bottom: 25px;
}

.setting-item {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.setting-item label {
    font-weight: bold;
    font-size: 1.1em;
}

.settings-container select {
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--input-background);
    color: var(--text-color);
    font-size: 1.05em;
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23f0f0f0%22%20d%3D%22M287%2C197.3L159.2%2C69.5c-3.6-3.6-8.2-5.4-12.8-5.4s-9.2%2C1.8-12.8%2C5.4L5.4%2C197.3c-7.2%2C7.2-7.2%2C18.8%2C0%2C26.1c7.2%2C7.2%2C18.8%2C7.2%2C26.1%2C0l115.4-115.4l115.4%2C115.4c7.2%2C7.2%2C18.8%2C7.2%2C26.1%2C0C294.2%2C216.1%2C294.2%2C204.5%2C287%2C197.3z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 14px;
}

.settings-container select:focus {
    outline: none;
    border-color: var(--button-background);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}

/* NEW: Style for the top-right settings button */
.top-right-settings-button {
    position: absolute; /* Position it relative to the .container */
    top: 0px; /* Adjust as needed, relative to container's top */
    right: 20px; /* Adjust as needed, relative to container's right */

    background-color: var(--border-color); /* Same color as before */
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px; /* Smaller size for a less prominent top button */
    height: 45px;
    font-size: 1.1em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* Slightly less prominent shadow */
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    z-index: 10; /* Ensure it's above other page content but below overlays */
}

.top-right-settings-button:hover {
    background-color: #666; /* Darker hover */
    transform: translateY(-2px); /* Slight lift on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.top-right-settings-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Corner Buttons (main action) */
.corner-button {
    position: fixed;
    bottom: 20px;
    background-color: var(--button-background);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.2em;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    z-index: 999;
}

.main-action-button {
    right: 20px; /* Position the "Add" button on the right */
}

.corner-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
}
.corner-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* --- Responsive Design --- */
@media (min-width: 768px) {
    .grid { /* History grid */
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }

    .stats-section {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 25px;
    }
    .top-right-settings-button {
        top: 0px; /* Ensure consistent top position on larger screens */
        right: 20px; /* Ensure consistent right position on larger screens */
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 30px;
    }

    .stats-section {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
    }

    .stat-card {
        padding: 25px;
    }

    .suggested-numbers .number-item {
        width: 55px;
        height: 55px;
        font-size: 1.2em;
    }
}

@media (min-width: 1300px) {
    .container {
        max-width: 1400px;
        padding: 0;
    }

    .stats-section {
        /* On very large screens, you might want more columns, e.g., 4 */
        grid-template-columns: repeat(4, 1fr);
    }
}