:root {
    --neon-pink: #ff2a85;
    --neon-cyan: #00f3ff;
    --neon-purple: #b537f2;
    --dark-bg: #050508;
    --panel-bg: rgba(10, 10, 20, 0.65);
    --glass-border: rgba(0, 243, 255, 0.3);
    --text-main: #e0e0e0;
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--dark-bg);
    background-image: url('../assets/images/cyber_debates_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.background-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(5,5,8,0.9) 0%, rgba(20,10,30,0.7) 100%);
    z-index: -1;
}

h1, h2, h3 { font-family: var(--font-heading); letter-spacing: 2px; }

.accent-text { color: var(--neon-cyan); text-shadow: 0 0 10px var(--neon-cyan); }
.hidden { display: none !important; }
.text-center { text-align: center; }

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 243, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    margin-bottom: 20px;
    border-radius: 12px;
    position: relative;
    z-index: 1000;
}

.logo h1 { 
    font-size: 2.8rem; 
    color: #ffffff; 
    text-shadow: 
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 20px var(--neon-pink),
        0 0 40px var(--neon-pink),
        0 0 80px var(--neon-pink);
    margin-bottom: 5px;
    letter-spacing: 4px;
    font-weight: 900;
}

.logo .accent-text { 
    color: #ffffff; 
    text-shadow: 
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 20px var(--neon-cyan),
        0 0 40px var(--neon-cyan),
        0 0 80px var(--neon-cyan);
}

.subtitle { 
    font-size: 1.1rem; 
    color: #ffffff; 
    letter-spacing: 8px; 
    font-weight: 600;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--neon-purple);
}

.user-stats { display: flex; align-items: center; gap: 20px; }
.stat { font-family: var(--font-heading); font-size: 1.2rem; color: gold; text-shadow: 0 0 10px rgba(255,215,0,0.5); }
.avatar-mini {
    width: 50px; height: 50px;
    border-radius: 50%;
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan);
    overflow: hidden;
}
.avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

/* Main Container */
.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px 20px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Forms & Inputs */
.input-group { margin-bottom: 15px; flex: 1; }
label { display: block; margin-bottom: 8px; font-family: var(--font-heading); color: var(--neon-cyan); font-size: 0.9rem;}
input {
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--neon-purple);
    color: white;
    padding: 12px 15px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
}
input:focus { border-color: var(--neon-cyan); box-shadow: 0 0 15px rgba(0,243,255,0.4); }

.settings-row { display: flex; gap: 20px; }

.user-display {
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid #39ff14;
    color: #39ff14;
    padding: 10px 15px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 5px #39ff14;
    box-shadow: inset 0 0 10px rgba(57,255,20,0.2), 0 0 10px rgba(57,255,20,0.3);
}

.cyber-select {
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--neon-purple);
    color: white;
    padding: 10px;
    font-family: var(--font-body);
    font-size: 1rem;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
}
.cyber-select:focus { border-color: var(--neon-cyan); box-shadow: 0 0 15px rgba(0,243,255,0.4); }
.cyber-select option { background: var(--dark-bg); color: white; padding: 10px 5px; cursor: pointer; }
.cyber-select[multiple] { height: 220px; }

/* Button */
.cyber-button {
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: white;
    padding: 15px 30px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    width: 100%;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    text-shadow: 0 0 5px white;
    box-shadow: inset 0 0 10px rgba(255,42,133,0.2), 0 0 15px rgba(255,42,133,0.4);
}
.cyber-button:hover { background: rgba(255,42,133,0.2); box-shadow: inset 0 0 20px rgba(255,42,133,0.5), 0 0 30px var(--neon-pink); text-shadow: 0 0 10px white; }
.cyber-button:disabled { border-color: #555; box-shadow: none; color: #888; cursor: not-allowed; }

.cyber-button.active-blue {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: inset 0 0 10px rgba(0,243,255,0.2), 0 0 15px rgba(0,243,255,0.4);
    text-shadow: 0 0 5px var(--neon-cyan);
}
.cyber-button.active-blue:hover {
    background: rgba(0,243,255,0.2);
    box-shadow: inset 0 0 20px rgba(0,243,255,0.5), 0 0 30px var(--neon-cyan);
    text-shadow: 0 0 10px white;
}

.cyber-button-alt {
    background: transparent;
    border: 2px solid var(--neon-cyan);
    color: white;
    padding: 15px 30px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    width: 100%;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    text-shadow: 0 0 5px white;
    box-shadow: inset 0 0 10px rgba(0,243,255,0.2), 0 0 15px rgba(0,243,255,0.4);
}
.cyber-button-alt:hover { background: rgba(0,243,255,0.2); box-shadow: inset 0 0 20px rgba(0,243,255,0.5), 0 0 30px var(--neon-cyan); text-shadow: 0 0 10px white; }

#stop-debate-btn:hover { background: rgba(255,0,0,0.2); box-shadow: inset 0 0 20px rgba(255,0,0,0.5), 0 0 30px red; text-shadow: 0 0 10px white; }


/* Arena / Chat */
.arena { flex: 1; display: flex; flex-direction: column; overflow: hidden; max-height: 70vh; }
.arena-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); padding-bottom: 15px; margin-bottom: 15px; }

.live-indicator { color: red; font-family: var(--font-heading); font-weight: bold; display: flex; align-items: center; gap: 5px; text-shadow: 0 0 10px red;}
.dot { width: 10px; height: 10px; background: red; border-radius: 50%; display: inline-block; animation: blink 1s infinite; box-shadow: 0 0 10px red; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.chat-container {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding-right: 10px;
    scroll-behavior: smooth;
}
.chat-container::-webkit-scrollbar { width: 8px; }
.chat-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 4px; }
.chat-container::-webkit-scrollbar-thumb { background: var(--neon-purple); border-radius: 4px; }

/* Messages */
.message {
    background: rgba(20,20,35,0.8);
    border-left: 4px solid var(--neon-cyan);
    padding: 15px;
    border-radius: 0 10px 10px 0;
    animation: slideIn 0.3s ease-out;
}
.message.arbiter {
    background: rgba(35,20,20,0.8);
    border-left: none;
    border-right: 4px solid var(--neon-pink);
    border-radius: 10px 0 0 10px;
    align-self: flex-end;
    width: 90%;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

.msg-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-family: var(--font-heading); font-size: 0.9rem;}
.msg-model { color: var(--neon-cyan); font-weight: bold; }
.message.arbiter .msg-model { color: var(--neon-pink); }
.msg-time { color: #666; }

.msg-content { font-size: 1.1rem; line-height: 1.6; }
.msg-content p, .reasoning-content p { margin-bottom: 12px; }
.msg-content p:last-child, .reasoning-content p:last-child { margin-bottom: 0; }
.msg-content ul, .msg-content ol { margin-bottom: 12px; padding-left: 20px; }
.msg-content li { margin-bottom: 5px; }

/* Collapsible Reasoning */
.reasoning-wrapper { margin-top: 15px; margin-bottom: 15px; background: rgba(0,0,0,0.4); border-radius: 5px; border: 1px solid #333; border-left: 3px solid #555; transition: all 0.3s; }
.reasoning-wrapper.active-thinking {
    border-left: 3px solid var(--neon-cyan);
    box-shadow: -5px 0 15px rgba(0,243,255,0.2);
    animation: pulseBorder 1.5s infinite;
}
@keyframes pulseBorder { 
    0% { border-left-color: var(--neon-cyan); } 
    50% { border-left-color: rgba(0,243,255,0.3); } 
    100% { border-left-color: var(--neon-cyan); } 
}

.reasoning-toggle {
    width: 100%; background: none; border: none; color: #888; padding: 8px 15px; text-align: left;
    font-family: var(--font-heading); font-size: 0.8rem; cursor: pointer; transition: color 0.3s;
    display: flex; justify-content: space-between; align-items: center;
}
.reasoning-toggle:hover { color: var(--neon-purple); }
.active-thinking .reasoning-toggle { color: var(--neon-cyan); }

.bottom-toggle { 
    border-top: 1px solid #333; 
    border-radius: 0 0 5px 5px; 
    justify-content: center; 
    display: none; 
}
.reasoning-wrapper:has(.reasoning-content.open) .bottom-toggle { 
    display: flex; 
}

.post-match-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.reasoning-content { padding: 15px; border-top: 1px solid #333; color: #aaa; font-size: 0.95rem; font-style: italic; display: none; }
.reasoning-content.open { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Status Bar */
.status-bar { margin-top: 15px; padding-top: 15px; border-top: 1px solid #333; display: flex; justify-content: space-between; font-size: 0.9rem; color: #888;}
.typing-indicator span {
    display: inline-block; width: 6px; height: 6px; background: var(--neon-cyan); border-radius: 50%; margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); box-shadow: 0 0 10px var(--neon-cyan); } }

/* Login Dropdown Overlay */
#login-dropdown {
    position: fixed !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 9999 !important;
    width: 90% !important;
    max-width: 300px !important;
    padding: 20px;
    box-shadow: 0 0 30px rgba(0,0,0,0.9), 0 0 15px var(--neon-cyan) !important;
    border: 1px solid var(--neon-cyan);
}

/* Responsive */
@media (max-width: 768px) {
    /* Header: keep as single row, logo left, buttons right */
    .main-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        gap: 8px;
    }

    /* Shrink logo on mobile */
    .logo h1 { font-size: 1.4rem; letter-spacing: 2px; }
    .logo .subtitle { font-size: 0.55rem; letter-spacing: 3px; }

    /* Buttons row: single line, no wrap, icon-only */
    .user-stats {
        flex-wrap: nowrap;
        justify-content: flex-end;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
    }

    /* Hide all button text labels on mobile */
    .cyber-button span,
    .cyber-button-alt span,
    .user-display span { display: none; }

    /* Compact square icon buttons */
    .cyber-button,
    .cyber-button-alt {
        padding: 7px 9px !important;
        font-size: 0.85rem !important;
        width: auto !important;
        min-width: unset !important;
        flex-shrink: 0;
    }

    /* Hide user-display on mobile to save space */
    .user-display { display: none !important; }

    /* Shrink the UTC clock widget */
    #server-clock {
        padding: 5px 7px;
        font-size: 0.7rem;
        gap: 4px;
    }
    #server-clock > span:first-of-type { display: none; } /* hide "UTC" label, keep time */

    /* Rest of page */
    .settings-row { flex-direction: column; gap: 10px; }
    .arena { max-height: none; padding: 10px; margin: 10px; }
}


/* Archive Section */
.archive-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; max-height: 80vh; }
.archive-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; padding-right: 10px; }
.archive-list::-webkit-scrollbar { width: 8px; }
.archive-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 4px; }
.archive-list::-webkit-scrollbar-thumb { background: var(--neon-cyan); border-radius: 4px; }

.dialog-card {
    background: rgba(20,20,35,0.8);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s;
    cursor: pointer;
}
.dialog-card:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0,243,255,0.3);
    transform: translateY(-2px);
}
.dialog-card-header {
    display: flex; justify-content: space-between; align-items: flex-start;
}
.dialog-card-topic {
    font-family: var(--font-heading); color: var(--neon-cyan); font-size: 1.1rem;
}
.dialog-card-date {
    color: #888; font-size: 0.9rem; white-space: nowrap; margin-left: 10px;
}

/* Suggestions Dropdown */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 10, 20, 0.95);
    border: 1px solid var(--neon-purple);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
    backdrop-filter: blur(10px);
}
.suggestions-list::-webkit-scrollbar { width: 6px; }
.suggestions-list::-webkit-scrollbar-track { background: transparent; }
.suggestions-list::-webkit-scrollbar-thumb { background: var(--neon-purple); }

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    transition: background 0.2s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover {
    background: rgba(181, 55, 242, 0.2);
    color: white;
}

/* Scroll to top button */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 15px var(--neon-cyan), inset 0 0 10px rgba(0, 243, 255, 0.5);
    z-index: 9999;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: rgba(0, 243, 255, 0.2);
    box-shadow: 0 0 25px var(--neon-cyan), inset 0 0 15px var(--neon-cyan);
    color: white;
    transform: translateY(-3px);
}

@media (max-width: 768px) {
    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        z-index: 10000;
    }
}

/* Debates Dashboard */
.debates-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.dashboard-column {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    max-height: 420px;
    overflow: hidden; /* column itself doesn't scroll */
}
.dashboard-header {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--neon-pink);
    border-bottom: 1px solid var(--neon-pink);
    padding: 14px 15px 10px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0; /* header never collapses */
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--panel-bg); /* opaque so content doesn't bleed through */
    backdrop-filter: blur(4px);
}
.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 15px 15px;
    overflow-y: auto;
    flex: 1;
    /* Cyberpunk custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--neon-cyan) rgba(0,243,255,0.05);
}
.dashboard-list::-webkit-scrollbar {
    width: 4px;
}
.dashboard-list::-webkit-scrollbar-track {
    background: rgba(0,243,255,0.05);
    border-radius: 2px;
}
.dashboard-list::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 2px;
    box-shadow: 0 0 6px var(--neon-cyan);
}
.dashboard-list::-webkit-scrollbar-thumb:hover {
    background: #fff;
}
.dashboard-card {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-body);
    flex-shrink: 0;
}
.dashboard-card:hover {
    background: rgba(0,243,255,0.1);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0,243,255,0.2);
}
.dashboard-card h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: white;
}
.dashboard-card .date {
    font-size: 0.8rem;
    color: #888;
}
