/* Modern Dark Theme - SlotTools - Applied to Bonus Predictions */
:root {
    --bg-dark-primary: #10111A;
    --bg-dark-secondary: #191A23;
    --bg-light-tertiary: #23242D;
    --border-color: #2E2F3A;
    --primary-accent: #4D7BFF;
    --primary-accent-hover: #6795ff;
    --secondary-accent: #6A5ACD;
    --text-primary: #EAEAEA;
    --text-secondary: #9A9A9A;
    --success: #28a745;
    --danger: #dc3545;
    --danger-hover: #c82333;
    --warning: #ffc107;
    --font-family: 'Poppins', sans-serif;
    --sidebar-width: 260px;
}

/* --- Base & Typography --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    margin: 0;
    padding-top: 65px; /* Space for fixed header */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
}

h1 {
    flex-grow: 1;
    text-align: center;
    font-size: 1.8rem;
    margin: 0;
    color: var(--text-primary);
}
h2 { font-size: 1.6rem; margin-bottom: 1.5rem; }
h3 { font-size: 1.3rem; margin-bottom: 15px; }
h4 { 
    font-size: 1.1rem; 
    margin-bottom: 1rem; 
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

a {
    color: var(--primary-accent);
    text-decoration: none;
}
a:hover { color: var(--primary-accent-hover); }

/* --- Layout --- */
.content-area {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

.content-area.content-expanded {
    margin-left: 0;
}


/* --- Header --- */
.header {
    background-color: var(--bg-dark-secondary);
    padding: 0 2rem;
    width: 100%;
    height: 65px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
.header-right { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    flex-shrink: 0;
    min-width: 0;
}
#kickNameText { 
    font-weight: 500; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
#profilePicture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-accent);
    flex-shrink: 0;
}

/* --- Sidebar --- */
.sidebar-toggle {
    background: none; border: none; color: var(--text-secondary);
    font-size: 1.2rem; cursor: pointer; padding: 0.5rem;
    flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); }

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-dark-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 65px;
    left: 0;
    height: calc(100vh - 65px);
    z-index: 900;
    padding-top: 1.5rem;
    transform: translateX(0);
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.sidebar.sidebar-hidden {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-title {
    padding: 0 1.5rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    font-weight: 600;
}
.tool-list { list-style: none; padding: 0; margin: 0; }
.tool-list a { display: block; text-decoration: none; padding: 0 1.5rem; }

.tool-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin: 0;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}
.tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}
.tool-icon i {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1;
}
.tool-name {
    font-weight: 500;
    color: var(--text-secondary);
}

.tool-item:hover { background-color: var(--bg-light-tertiary); }
.tool-item:hover .tool-name, .tool-item:hover .tool-icon i { color: var(--text-primary); }
.tool-item.active { background-color: rgba(77, 123, 255, 0.1); }
.tool-item.active .tool-name, .tool-item.active .tool-icon i { color: var(--primary-accent); }

/* --- General Components (Buttons, Inputs) --- */
button, .button {
    font-family: var(--font-family);
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
select, input[type="text"], input[type="number"], input[type="password"], textarea {
    background-color: var(--bg-dark-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 15px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    width: 100%;
    transition: all 0.2s ease;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary-accent); box-shadow: 0 0 0 2px rgba(77, 123, 255, 0.2); }

/* --- Bonus Prediction Tool Specific Styles --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.panel {
    background-color: var(--bg-dark-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.full-width {
    grid-column: span 2;
    padding: 0;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Wrapper for start button and timer to control spacing */
.start-and-timer-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Reduced gap */
}

.start-stop-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.start-stop-container > #toggle-predictions-btn {
    flex-grow: 1;
}

#toggle-predictions-btn {
    background-color: var(--success);
    color: white;
    transition: background-color 0.2s ease-in-out;
}
#toggle-predictions-btn.active {
    background-color: var(--danger);
}

#find-winner-btn { background-color: var(--secondary-accent); color: white; }
#clear-predictions-btn { 
    background-color: var(--danger); 
    color: white; 
    padding: 8px 16px;
    font-size: 0.9rem;
}
#clear-predictions-btn:hover { background-color: var(--danger-hover); }

button:disabled {
    background-color: var(--bg-light-tertiary) !important;
    color: var(--text-secondary) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.status {
    font-size: 1rem;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    text-transform: uppercase;
}

.status.active {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.status.inactive {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.input-group input {
    width: auto;
    flex-grow: 1;
}

/* Subscriber Mode Toggle */
.subscriber-mode { 
    display: flex; 
    align-items: center;
    gap: 0.75rem;
} 
.subscriber-mode .toggle-label {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--bg-dark-primary); transition: .3s; border-radius: 24px; border: 1px solid var(--border-color); }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-accent); }
input:checked + .slider:before { transform: translateX(20px); }

/* Predictions List & Table */
.predictions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.predictions-list {
    max-height: 460px;
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 8px;
}
.predictions-list::-webkit-scrollbar { width: 6px; }
.predictions-list::-webkit-scrollbar-track { background: var(--bg-dark-primary); }
.predictions-list::-webkit-scrollbar-thumb { background-color: var(--bg-light-tertiary); border-radius: 3px; }
.predictions-list::-webkit-scrollbar-thumb:hover { background-color: var(--primary-accent); }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-dark-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.85rem;
    text-transform: uppercase;
}

td:first-child { font-weight: 600; color: var(--text-primary); }
td:nth-child(2) { font-family: 'Poppins', sans-serif; font-weight: 500; }

tbody tr { transition: background-color: 0.2s ease; }
tbody tr:hover { background-color: var(--bg-light-tertiary); }
tbody tr:last-child td { border-bottom: none; }

tr.winner {
    background-color: rgba(106, 90, 205, 0.2) !important;
}
tr.winner td {
    color: var(--secondary-accent);
    font-weight: 700;
}

/* Connection Status */
.connection-status {
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%);
}
.connection-status::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.connected { background-color: rgba(40, 167, 69, 0.2); color: #6ee7b7; }
.connected::before { background-color: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }
.disconnected { background-color: rgba(220, 53, 69, 0.2); color: #fda4af; }
.disconnected::before { background-color: var(--danger); }
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

/* Summary & Winner Display */
.summary-panel {
    text-align: center;
}
#prediction-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}
#winner-display {
    background-color: var(--bg-dark-primary);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--secondary-accent);
    min-height: 300px; /* Restored original height */
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
#winner-display strong { font-size: 1.3rem; color: var(--primary-accent); }

.header-container {
    position: relative;
    display: flex;
    align-items: center;
    padding: 2rem 1.5rem;
}

/* --- Timer Styles --- */
.timer-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}
.timer-display {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-dark-primary);
    padding: 8px 12px;
    border-radius: 8px;
    letter-spacing: 2px;
    flex-shrink: 0;
    width: 7rem; 
    display: flex;
    align-items: center;
    justify-content: center;
}
.timer-inputs {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-grow: 1;
}
.timer-inputs input {
    text-align: center;
}
.timer-inputs label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* --- Modals (Login) --- */
#usernameModal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: none; /* Controlled by PHP */
}
#popupContent {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-dark-secondary);
    border-radius: 16px;
    padding: 2rem;
    z-index: 9999;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 450px; 
    text-align: center;
}
#kickLoginButton {
background-color: #000;
color: #fff;
width: 100%;
font-size: 1rem;
}
#kickLoginButton:hover {
background-color: #000;
color: #fff;
text-decoration: none;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
    .sidebar.sidebar-hidden { transform: translateX(calc(-1 * var(--sidebar-width))); }
    .sidebar:not(.sidebar-hidden) { transform: translateX(0); box-shadow: 0 0 50px rgba(0,0,0,0.5); }
    .content-area { margin-left: 0; }
}

@media (max-width: 768px) {
    .content-area { padding: 1rem; }
    .header { padding: 0 1rem; }

    .container { 
        display: flex;
        flex-direction: column;
    }
    .panel.full-width { 
        padding: 0; 
        order: 1;
    }
    .panel:nth-child(2) { 
        order: 2;
    }
    .panel:nth-child(3) { 
        order: 3;
    }
    
    .header-container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.5rem 1rem;
    }
    h1 {
        flex-grow: 0;
        font-size: 1.6rem;
    }
    .connection-status {
        position: static;
        transform: none;
    }
    
    .predictions-list { max-height: 300px; }
    #winner-display {
        min-height: 60px;
    }
}

@media (max-width: 480px) {
    .content-area { padding: 0.75rem; }
    #popupContent { 
        padding: 1.5rem; 
        width: 95%; 
        max-width: none;
    }
    .panel, .panel:not(.full-width) { padding: 1rem; }
    .timer-section {
        flex-direction: column; /* Stack timer vertically on small screens */
    }
}