/* --- Futuristic Dark Theme --- */
:root {
    --bg-color: #121212;
    --primary-surface: #1e1e1e;
    --secondary-surface: #2a2a2a;
    --primary-accent: #007BFF;
    --secondary-accent: #00BFFF;
    --primary-text: #e0e0e0;
    --secondary-text: #a0a0a0;
    --border-color: #444;
    --font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* --- Base & Typography --- */
body {
    background-color: var(--bg-color);
    color: var(--primary-text);
    font-family: var(--font-family);
    margin: 0;
    line-height: 1.6;
}
.container {
    padding: 20px;
}
h1, h2, h3 {
    color: white;
    font-weight: 600;
    margin: 0 0 15px 0;
}
a {
    color: var(--primary-accent);
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: var(--secondary-accent);
}

/* --- Main Panel Layout --- */
.panel-content {
    /* Static margin for the collapsed menu, content no longer moves */
    margin-left: 90px;
    padding: 20px;
    box-sizing: border-box;
}
.panel-menu {
    width: 90px;
    background-color: var(--primary-surface);
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 25px 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: width 0.3s ease-in-out;
    overflow-x: hidden;
}
.panel-menu.menu-expanded {
    width: 240px;
}
.panel-menu.menu-expanded .menu-text {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease 0.1s;
}

/* --- Menu & Submenu Styles --- */
.panel-menu h2 {
    font-size: 1.6em; color: white; margin-bottom: 30px;
    display: flex; align-items: center; padding: 0 30px; white-space: nowrap;
}
.panel-menu h2 i {
    font-size: 1em; min-width: 30px; text-align: center; margin-right: 15px;
}
.panel-menu .menu-buttons {
    list-style: none; padding: 0; flex-grow: 1;
}
.panel-menu .menu-buttons a {
    display: flex; align-items: center; height: 50px; padding: 0 30px;
    color: var(--secondary-text); font-weight: 500;
    transition: all 0.2s ease; border-left: 4px solid transparent; white-space: nowrap;
}
.panel-menu .menu-buttons a i {
    font-size: 1.2em; min-width: 30px; text-align: center; margin-right: 15px;
}
.panel-menu .menu-text {
    opacity: 0; visibility: hidden; transition: opacity 0.1s ease, visibility 0.1s ease;
}
.panel-menu .has-submenu {
    display: grid; grid-template-rows: auto 0fr; transition: grid-template-rows 0.3s ease-in-out;
}
.panel-menu .has-submenu.open { grid-template-rows: auto 1fr; }
.panel-menu .has-submenu > a { justify-content: space-between; cursor: pointer; }
.panel-menu .has-submenu > a::after { content: '›'; font-size: 1.5em; font-weight: bold; transition: transform 0.3s ease; }
.panel-menu .has-submenu.open > a::after { transform: rotate(90deg); }
.submenu-wrapper { overflow: hidden; }
.submenu { list-style: none; padding: 10px 0 0 15px; }
.submenu a { font-size: 0.9em; font-weight: 400; padding: 8px 15px 8px 34px; height: 40px; border: none; }
.panel-menu .menu-buttons a:hover,
.panel-menu .menu-buttons .has-submenu.open > a { background-color: var(--secondary-surface); color: white; }
.panel-menu .menu-buttons a.active { background-color: rgba(0, 123, 255, 0.1); color: var(--primary-accent); border-left: 4px solid var(--primary-accent); }
/* In styles.css, find and replace the existing .submenu a rule */
.submenu a {
    display: flex; /* Aligns icon and text */
    align-items: center;
    font-size: 0.9em;
    font-weight: 400;
    padding: 8px 15px 8px 49px; /* Adjusted padding for icon */
    height: 40px;
    border: none;
}
/* Add this new rule for the submenu icons */
.submenu a i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    color: var(--secondary-text);
}
/* --- Menu Toggle, Overlay & Exit Button --- */
.menu-toggle-btn {
    position: fixed; top: 20px; left: 25px; z-index: 1001;
    background-color: var(--primary-surface); color: white;
    border: 1px solid var(--border-color); border-radius: 8px;
    width: 40px; height: 40px; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.menu-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 999; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out; }
.menu-overlay.visible { opacity: 1; visibility: visible; }
.exit-button { display: flex; align-items: center; height: 50px; padding: 0 30px; text-align: left; background-color: var(--secondary-surface); color: var(--secondary-text); font-weight: 500; transition: background-color 0.3s; }
.exit-button:hover { background-color: var(--secondary-accent); color: white; }
.exit-button i, .logout-avatar { font-size: 1.2em; min-width: 30px; text-align: center; margin-right: 15px; flex-shrink: 0; }
.logout-avatar { width: 30px; height: 30px; border-radius: 50%; }
.logout-container .logout-button { background: none; border: none; padding: 0; margin: 0; color: var(--secondary-text); font-size: 1em; font-family: var(--font-family); cursor: pointer; flex-grow: 1; text-align: left; }
.logout-container:hover .logout-button { color: white; }

/* --- All Other Component & Content Styles --- */
.stat-boxes { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 20px; }
.stat-box { background: linear-gradient(145deg, var(--secondary-surface), var(--primary-surface)); border: 1px solid var(--border-color); transition: transform 0.3s ease, box-shadow 0.3s ease; padding: 25px; flex-grow: 1; min-width: 200px; border-radius: 8px; }
.stat-box:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); }
.stat-box h3 { margin: 0 0 10px 0; color: var(--secondary-text); font-size: 1em; text-transform: uppercase; font-weight: 600; }
.stat-box .stat-number { font-size: 2.5em; font-weight: bold; color: white; }
button, a.button { background-color: var(--primary-accent); color: white; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-size: 1em; transition: background-color 0.3s; display: inline-block; }
button:hover, a.button:hover { background-color: var(--secondary-accent); }
select { padding: 8px; border-radius: 4px; border: 1px solid var(--border-color); background-color: var(--secondary-surface); color: var(--primary-text); font-size: 1em; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; background-color: var(--primary-surface); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; font-size: 0.95em; table-layout: fixed; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
th { background-color: var(--secondary-surface); color: var(--primary-accent); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background-color: #2a2a2a; }
td .long-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#users-table td img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.assigned-user-cell .user-info-block { padding: 2px 0; }
.assigned-user-cell .user-info-block img { width: 36px; height: 36px; }
.user-info-block { display: flex; align-items: center; gap: 12px; }
.user-info-block img { width: 40px; height: 40px; border-radius: 50%; border: none; flex-shrink: 0; }
.user-info-block .details { display: flex; flex-direction: column; justify-content: center; line-height: 1.3; overflow: hidden; }
.user-info-block .details .name { font-weight: 600; color: var(--primary-text); white-space: nowrap; }
.user-info-block .details .email { font-size: 0.85em; color: var(--secondary-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.gift-card { background-color: var(--primary-surface); border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; text-align: center; display: flex; flex-direction: column; justify-content: space-between; transition: all 0.2s ease; }
.gift-card.has-sound { border-color: var(--primary-accent); box-shadow: 0 0 10px rgba(0, 123, 255, 0.3); }
.gift-card img { width: 80px; height: 80px; object-fit: contain; margin: 0 auto 10px auto; }
.gift-info .gift-name { font-weight: 600; color: var(--primary-text); display: block; line-height: 1.2; }
.gift-info .gift-points { font-size: 0.8em; color: var(--secondary-text); }
.gift-actions { margin-top: 15px; display: flex; justify-content: center; gap: 10px; }
.sort-controls { display: flex; gap: 10px; align-items: center; }
.sort-controls label { font-weight: 500; color: var(--secondary-text); }
.sort-controls .sort-btn { background-color: var(--secondary-surface); color: var(--secondary-text); border: 1px solid var(--border-color); padding: 6px 12px; font-size: 0.9em; cursor: pointer; border-radius: 5px; }
.sort-controls .sort-btn.active { background-color: var(--primary-accent); color: white; border-color: var(--primary-accent); }
.add-new-btn { background-color: #007BFF; display: inline-flex; align-items: center; gap: 8px; }
.add-new-btn:hover { background-color: #007BFF; }
.music-manager-container { height: calc(100dvh - 220px); display: flex; flex-direction: column; }
.song-list-container { flex-grow: 1; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 8px; }
.song-list-container thead th { position: sticky; top: 0; z-index: 1; }
.song-list th.sortable { cursor: pointer; user-select: none; }
.song-list th.sortable:hover { background-color: #3a3a3a; }
.sort-indicator { display: inline-block; vertical-align: middle; width: 1em; height: 1em; margin-left: 8px; opacity: 0.4; }
.sort-indicator.asc, .sort-indicator.desc { opacity: 1; }
.sort-indicator.asc svg, .sort-indicator.desc svg { display: block; }
.sort-indicator.desc svg { transform: rotate(180deg); }
.song-list .actions { display: flex; align-items: center; gap: 8px; }
.song-list .actions button, .song-list .actions .icon-btn { display: flex; align-items: center; justify-content: center; padding: 6px 10px; font-size: 0.9em; }
.icon-btn { background: transparent; border: none; padding: 0; margin: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; }
.icon-btn svg { width: 18px; height: 18px; fill: var(--secondary-text); transition: fill 0.2s ease; }
.icon-btn:hover { background-color: var(--secondary-surface); }
.icon-btn:hover svg { fill: white; }
.icon-btn.play-btn:hover, .song-list .play-btn.playing { background-color: var(--primary-accent); }
.icon-btn.play-btn:hover svg, .song-list .play-btn.playing svg { fill: white; }
.icon-btn.delete-btn:hover { background-color: #e94560; }
.song-list .play-btn.playing .play-icon, .song-list .play-btn:not(.playing) .pause-icon { display: none; }
.upload-fab { position: fixed; bottom: 100px; right: 30px; width: 60px; height: 60px; border-radius: 50%; background-color: var(--primary-accent); color: white; font-size: 32px; line-height: 60px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); border: none; cursor: pointer; z-index: 1002; transition: background-color 0.2s ease, transform 0.2s ease; }
.upload-fab:hover { background-color: var(--secondary-accent); transform: scale(1.05); }
.floating-player { position: fixed; bottom: 0; left: 90px; right: 0; background-color: var(--secondary-surface); color: var(--primary-text); padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border-color); z-index: 1001; transform: translateY(100%); transition: transform 0.3s ease-in-out, left 0.3s ease-in-out; }
body.menu-is-open .floating-player { left: 240px; }
.floating-player.visible { transform: translateY(0); }
.fp-song-info .label { font-size: 0.8em; color: var(--secondary-text); }
.fp-song-info .song-title { font-weight: 600; }
.fp-controls button { background: none; border: 2px solid var(--secondary-text); color: var(--secondary-text); width: 45px; height: 45px; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.fp-controls button:hover { color: white; border-color: white; }
.fp-controls .pause-icon { display: none; }
.fp-controls.playing .pause-icon { display: block; }
.fp-controls.playing .play-icon { display: none; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 2000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-content { background-color: var(--primary-surface); padding: 30px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.3); width: 90%; max-width: 500px; transform: scale(0.9); transition: transform 0.3s ease; }
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 20px; }
.modal-header h2 { margin: 0; }
.modal-close-btn { background: none; border: none; color: var(--secondary-text); font-size: 28px; cursor: pointer; line-height: 1; }
.modal-close-btn:hover { color: white; }
.upload-form input[type="file"] { display: block; width: 100%; padding: 12px; border: 2px dashed var(--border-color); border-radius: 8px; background-color: var(--secondary-surface); margin-bottom: 20px; color: var(--secondary-text); }
.upload-form button { width: 100%; padding: 12px; font-size: 1.1em; }
.modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-color); }

/* --- Final Responsive Adjustments --- */
@media (max-width: 768px) {
    .panel-content { margin-left: 0; width: 100%; }
    .panel-menu { left: -280px; width: 280px; }
    .panel-menu.menu-expanded { left: 0; }
    .panel-menu .menu-text { opacity: 1; visibility: visible; }
    .menu-toggle-btn { display: flex; }
    body.menu-is-open .menu-toggle-btn { left: auto; right: 20px; }
    table, thead, tbody, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; }
    tr { border: 1px solid var(--border-color); margin-bottom: 15px; border-radius: 8px; background-color: var(--primary-surface); padding: 15px; }
    td { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding: 10px 0; text-align: right; }
    td:last-child { border-bottom: none; }
    td:before { content: attr(data-label); font-weight: 600; text-align: left; color: var(--primary-text); padding-right: 10px; }
    td.action-cell { width: auto; }
    td.action-cell form { flex-direction: row; }
    td.action-cell select, td.action-cell button { width: auto; }
    .floating-player { left: 0; }
    .upload-fab { right: 20px; }
}
/* Add or replace these styles in your main CSS file */

.stats-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}
.robot-picture {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border-color);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.stat-card {
    background-color: var(--primary-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.stat-card-header h3 {
    margin: 0;
    color: var(--secondary-text);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.stat-card .stat-value {
    font-size: 2.5em;
    font-weight: 600;
    color: white;
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.9em;
    color: var(--secondary-text);
}
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--secondary-surface);
    border-radius: 4px;
    margin-top: 15px;
    overflow: hidden;
}
.progress-bar-inner {
    height: 100%;
    background: var(--primary-accent);
    border-radius: 4px;
    transition: width 0.5s linear;
}


    /* Add/Update these styles within your _dashboard.ejs style block */
    .stat-boxes {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        margin-top: 30px;
        justify-content: center; /* Center if less than full row */
    }

    .stat-box {
        background-color: var(--card-bg-color); /* Assuming you have CSS variables */
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
        padding: 20px;
        flex: 1; /* Allow boxes to grow/shrink */
        min-width: 200px; /* Minimum width before wrapping */
        max-width: 300px; /* Max width for larger screens */
        text-align: center;
        transition: transform 0.2s ease-in-out;
        border: 1px solid transparent; /* Default transparent border */
    }

    .stat-box:hover {
        transform: translateY(-5px);
    }

    .stat-box h3 {
        color: var(--primary-color); /* Default color for headings */
        margin-bottom: 10px;
        font-size: 1.2em;
    }

    .stat-box .stat-number {
        font-size: 2.5em;
        font-weight: bold;
        color: var(--text-color); /* Default color for numbers */
    }

    /* NEW: Specific colors for ticket stats boxes */
    .stat-box-red {
        background-color: #3d2c2d; /* Dark red background */
        border-color: #ea4335; /* Red border */
    }
    .stat-box-red h3 {
        color: #ea4335; /* Red heading */
    }
    .stat-box-red .stat-number {
        color: #ff9999; /* Lighter red number */
    }

    .stat-box-orange {
        background-color: #3d332c; /* Dark orange background */
        border-color: #fbbc05; /* Orange border */
    }
    .stat-box-orange h3 {
        color: #fbbc05; /* Orange heading */
    }
    .stat-box-orange .stat-number {
        color: #ffdd99; /* Lighter orange number */
    }

    .stat-box-green {
        background-color: #2c3d2d; /* Dark green background */
        border-color: #34a853; /* Green border */
    }
    .stat-box-green h3 {
        color: #34a853; /* Green heading */
    }
    .stat-box-green .stat-number {
        color: #99ff99; /* Lighter green number */
    }
    
/* New Network Block Styles */
.network-io-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-grow: 1;
    gap: 20px;
}
.network-io-block {
    text-align: center;
}
.network-io-block i {
    font-size: 1.8em;
    margin-bottom: 5px;
    color: var(--primary-accent);
}
.network-io-block .speed {
    font-size: 1.8em;
    font-weight: 600;
    color: white;
}
.network-io-block .speed-label {
    font-size: 0.8em;
    color: var(--secondary-text);
    text-transform: uppercase;
}
/* Add these styles to your main CSS file */

/* --- Settings Page Layout & Cards --- */
.settings-container {
    max-width: 100%;
    margin: 0 auto;
}
.settings-card h2 {
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.settings-card h2 i {
    color: var(--primary-accent);
}
.settings-card p.description {
    font-size: 0.9em;
    color: var(--secondary-text);
    margin-top: -10px;
    margin-bottom: 20px;
}

/* --- Button-Style Toggles --- */
.toggle-btn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.toggle-btn {
    display: block;
    position: relative;
}
.toggle-btn input[type="checkbox"] {
    display: none; /* Hide the actual checkbox */
}
.toggle-btn span {
    display: block;
    padding: 10px;
    text-align: center;
    background-color: var(--secondary-surface);
    color: var(--secondary-text);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.toggle-btn input[type="checkbox"]:checked + span {
    background-color: var(--primary-accent);
    color: white;
    border-color: var(--primary-accent);
}
.toggle-btn input[type="checkbox"]:hover + span {
    border-color: var(--secondary-accent);
}

/* --- Multi-Column Layouts --- */
.settings-row, .settings-grid-2-col, .settings-grid-3-col {
    display: grid;
    gap: 20px;
    align-items: end;
}
.settings-row {
    grid-template-columns: 1fr 1fr;
}
.settings-grid-2-col {
    grid-template-columns: 1fr 1fr;
}
.settings-grid-3-col {
    grid-template-columns: 1fr 1fr 1fr;
}

/* --- Custom Range Sliders --- */
.slider-group {
    display: flex;
    align-items: center;
    gap: 15px;
}
.slider-group .slider-value {
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: var(--secondary-surface);
    border-radius: 5px;
    outline: none;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-accent);
    cursor: pointer;
    border-radius: 50%;
}
input[type=range]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-accent);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

/* Responsive adjustments for settings grids */
@media (max-width: 600px) {
    .settings-row, .settings-grid-2-col, .settings-grid-3-col {
        grid-template-columns: 1fr; /* Stack everything on small screens */
    }
}

/* Add these new styles to your CSS file */

/* --- Settings Page Section Layout --- */
.settings-section {
    background-color: var(--primary-surface);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.settings-section .section-title {
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
    margin-top: 0;
}
.settings-section .section-title i {
    color: var(--primary-accent);
}
.settings-section .description {
    font-size: 0.9em;
    color: var(--secondary-text);
    margin-top: -15px;
    margin-bottom: 25px;
}

/* In styles.css */

/* --- Final Settings Page Redesign --- */

/* Replace the old .settings-card h2 */
.settings-section .section-title {
    text-align: center; /* Center section titles */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

/* Container for groups of settings */
.settings-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
}

/* Individual setting item styling */
.setting-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 150px;
}
.setting-item label {
    font-weight: 500;
    color: var(--secondary-text);
    font-size: 0.9em;
}
.setting-item input,
.setting-item select {
    width: 120px; /* Give a consistent width */
    text-align: center;
    background-color: var(--bg-color);
    font-weight: 600;
}

/* Specific override for language selector */
.setting-item #tts_lang {
    width: 150px;
}

/* Makes the button-like toggles centered */
.toggle-btn-grid {
    justify-content: center;
}

/* Two-column layout for TTS settings */
.settings-tts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}
.tts-sliders {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.tts-sliders .setting-item {
    width: 100%;
}
.tts-sliders .setting-item input[type="range"] {
    width: 100%;
}

/* Floating Save Button Footer */
.floating-save-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(18, 18, 18, 1), rgba(18, 18, 18, 0.9), rgba(18, 18, 18, 0));
    padding: 30px 20px 20px 20px;
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    pointer-events: none; /* Allows scrolling through the gradient area */
}
.floating-save-footer button {
    pointer-events: auto; /* Makes the button clickable */
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.4);
}

/* Responsive adjustments for the new layout */
@media (max-width: 600px) {
    .settings-tts-grid {
        grid-template-columns: 1fr;
    }
}

/* Find this rule in your CSS */
.setting-item input,
.setting-item select {
    width: 120px;
    text-align: center;
    background-color: var(--bg-color);
    font-weight: 600;
}

/* And replace it with this */
.setting-item input,
.setting-item select {
    width: 120px;
    text-align: center;
    background-color: var(--secondary-surface); /* Better contrast */
    color: var(--primary-text); /* This makes the text white */
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
}

/* Add this new rule to your CSS file */

/* --- Page-Specific Overrides --- */
body.settings-view .container {
    max-width: none; /* Allows the settings page to use the full width */
}

/* Add these new rules to your CSS file */

.setting-item label {
    /* ... existing styles ... */
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    margin-bottom: 5px;
}

.setting-label-main {
    font-weight: 500;
    color: var(--secondary-text);
    font-size: 0.9em;
}

.setting-label-sub {
    font-size: 0.8em;
    color: var(--primary-accent);
    font-family: monospace; /* Gives a nice "code" look */
}

/* --- Chat Command Form Styles --- */
.command-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.command-form .form-group {
    display: flex;
    flex-direction: column;
}
.command-form .form-group label {
    color: var(--secondary-text);
    font-size: 0.9em;
    margin-bottom: 5px;
}
.command-form .form-group input,
.command-form .form-group select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-surface);
    color: var(--primary-text);
    font-size: 1em;
}
.command-form .full-width {
    grid-column: 1 / -1;
}
.command-form .sound-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.delete-command-btn {
    background-color: #e74c3c;
}
.delete-command-btn:hover {
    background-color: #c0392b;
}

.days-form {
    display: flex;
    align-items: center;
    gap: 10px;
}
.days-input {
    width: 60px;
    padding: 8px;
    background-color: #1e1e1e;
    border: 1px solid #444;
    color: white;
    border-radius: 5px;
}
.days-btn {
    padding: 8px 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
.days-btn:hover {
    background-color: #0056b3;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 15px;
}
.robot-cell {
    display: flex;
    align-items: center;
    gap: 15px;
}
img.user-picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}
.robot-table-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.robot-info-cell {
    display: flex;
    align-items: center;
    gap: 15px;
}
.robot-table-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #444;
}

        .info-card {
            background-color: #2c2c2c;
            padding: 25px;
            border-radius: 12px;
            border: 1px solid #333;
            margin-top: 20px;
        }
        .info-card.success {
            border-left: 5px solid #28a745;
        }
        .info-card.error {
            border-left: 5px solid #dc3545;
        }
        .info-card-content {
            display: flex;
            align-items: center;
            gap: 20px;
        }
        .robot-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            border: 2px solid #444;
            object-fit: cover;
            flex-shrink: 0;
        }
        .info-details {
            text-align: left;
        }
        .info-details h3 {
            margin-top: 0;
            margin-bottom: 5px;
            font-size: 1.5em;
            color: #ffffff;
        }
        .info-details p {
            font-size: 1.1em;
            color: #ccc;
            margin: 0;
        }
        .info-details .days-left {
            font-weight: bold;
            color: #28a745;
        }
        .info-details .days-left.expired {
            color: #dc3545;
        }
        .no-robot-card {
            text-align: center;
        }
        
        /* --- NEW: Global Stats Panel Styles --- */
        .global-stats-panel {
            background-color: #2c2c2c;
            padding: 25px;
            border-radius: 12px;
            border: 1px solid #333;
            margin-top: 30px;
        }
        .global-stats-panel h2 {
            margin-top: 0;
            margin-bottom: 25px;
            color: #ffffff;
            border-bottom: 1px solid #444;
            padding-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .stats-main-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 25px;
            align-items: stretch; /* Make all cards equal height */
        }
        .stats-card {
            background: linear-gradient(145deg, #2a2a2a, #1e1e1e);
            padding: 25px;
            border-radius: 10px;
            border: 1px solid #444;
            display: flex;
            flex-direction: column;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        .stats-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.3);
        }
        .stats-card-header {
            display: flex;
            align-items: center;
            gap: 15px;
            color: #aaa;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #444;
        }
        .stats-card-header i {
            font-size: 1.5em;
            color: #007bff;
        }
        .stats-card-header h3 {
            margin: 0;
            font-size: 1.1em;
            text-transform: uppercase;
        }
        .stats-card-body {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            text-align: center;
        }
        .stats-card .value {
            font-size: 2.8em;
            font-weight: 700;
            color: #ffffff;
            line-height: 1.1;
        }
        .stats-card .label {
            font-size: 1em;
            color: #ccc;
        }

        .top-robot-card {
            border-top: 4px solid #ffc107;
        }
        .top-robot-card .stats-card-header i {
            color: #ffc107;
        }
        .top-robot-avatar {
            width: 60px; /* Smaller avatar for the new layout */
            height: 60px;
            border-radius: 50%;
            border: 2px solid #ffc107;
        }
        .top-robot-name {
            font-size: 1.5em; /* Adjusted font size */
            font-weight: bold;
            color: #ffffff;
        }
        .top-robot-info {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
        }
        
        /* Optional: Add some basic styling for the notification */
        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 15px 25px;
            border-radius: 8px;
            font-weight: bold;
            color: white;
            z-index: 1000;
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
            transition: opacity 0.5s ease-in-out;
            opacity: 0; /* Hidden by default */
        }
        .notification.show {
            opacity: 1;
        }
        .notification.success {
            background-color: #4CAF50; /* Green */
        }
        .notification.error {
            background-color: #f44336; /* Red */
        }
        
}
.info-header-text h1 {
    margin: 0 0 5px 0;
    color: #ffffff;
}
.info-header-text p {
    margin: 0;
    color: #ccc;
    font-size: 1.1em;
}
.info-box {
    background-color: #2c2c2c;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #333;
    margin-top: 20px;
}
.info-box h3 {
    margin-top: 0;
    font-size: 1.5em;
    color: #ffffff;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.info-box p {
    font-size: 1.1em;
    color: #ccc;
    line-height: 1.6;
}
.days-left {
    font-weight: bold;
    color: #28a745;
}
.days-left.expired {
    color: #dc3545;
}

