@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap');

:root {
    --bg-dark: #0a0a0c;
    --glass-bg: rgba(18, 18, 22, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary-glow: #f97316;
    --secondary-glow: #ea580c;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --msg-mine: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --msg-theirs: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.bg-orb { position: absolute; border-radius: 50%; filter: blur(90px); z-index: -1; animation: float 12s infinite alternate ease-in-out; }
.orb-1 { width: 400px; height: 400px; background: var(--primary-glow); top: -10%; left: -10%; opacity: 0.35; }
.orb-2 { width: 500px; height: 500px; background: var(--secondary-glow); bottom: -20%; right: -10%; opacity: 0.25; animation-delay: -5s; }
.orb-3 { width: 300px; height: 300px; background: #fdba74; top: 40%; left: 40%; opacity: 0.15; animation-delay: -2s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 60px) scale(1.15); }
}

.glass-effect, .glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.login-container { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; z-index: 10; }
.login-panel { padding: 60px 50px; border-radius: 24px; text-align: center; max-width: 450px; animation: popIn 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes popIn { from { opacity: 0; transform: translateY(30px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

.login-icon-wrapper { width: 80px; height: 80px; background: linear-gradient(135deg, #f97316, #ea580c); border-radius: 20px; display: flex; justify-content: center; align-items: center; margin: 0 auto 30px auto; box-shadow: 0 10px 25px rgba(249, 115, 22, 0.5); transform: rotate(-5deg); transition: transform 0.3s ease; }
.login-panel:hover .login-icon-wrapper { transform: rotate(0deg) scale(1.05); }
.discord-icon { width: 45px; height: 45px; }

.glow-text { font-size: 2.2rem; font-weight: 800; margin-bottom: 15px; background: linear-gradient(to right, #fff, #fdba74); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-shadow: 0 0 30px rgba(253, 186, 116, 0.4); }
.login-panel p { color: var(--text-muted); margin-bottom: 40px; font-size: 1.05rem; line-height: 1.5; }

.login-btn-epic { display: inline-block; width: 100%; padding: 18px 0; background: linear-gradient(135deg, #f97316, #ea580c); color: white; text-decoration: none; border-radius: 14px; font-size: 1.1rem; font-weight: 800; letter-spacing: 1px; box-shadow: 0 0 20px rgba(249, 115, 22, 0.4); transition: all 0.3s ease; border: 1px solid rgba(255,255,255,0.1); position: relative; overflow: hidden; }
.login-btn-epic::after { content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); transform: skewX(-20deg); transition: all 0.6s ease; }
.login-btn-epic:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(249, 115, 22, 0.6); background: linear-gradient(135deg, #fb923c, #f97316); }
.login-btn-epic:hover::after { left: 150%; }

.chat-container { display: flex; width: 90%; max-width: 1400px; height: 85vh; border-radius: 20px; overflow: hidden; transition: all 0.3s ease; }
.sidebar { width: 300px; background: rgba(10, 11, 16, 0.4); padding: 25px 20px; border-right: 1px solid var(--glass-border); display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.sidebar h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 15px; margin-top: 10px; }
.sidebar ul { list-style: none; }
.sidebar li { padding: 14px 18px; margin-bottom: 8px; border-radius: 14px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); color: var(--text-muted); border: 1px solid transparent; font-weight: 600; display: flex; align-items: center;}
.sidebar li:hover { background: rgba(255, 255, 255, 0.05); color: white; transform: translateX(5px); }
.sidebar li.active { background: rgba(249, 115, 22, 0.15); color: white; border: 1px solid rgba(249, 115, 22, 0.3); box-shadow: inset 0 0 20px rgba(249, 115, 22, 0.1); }
.glass-divider { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--glass-border), transparent); margin: 20px 0; }

.admin-chat-btn { background: linear-gradient(90deg, rgba(234, 88, 12, 0.1), rgba(249, 115, 22, 0.1)); color: #fff !important; border: 1px solid rgba(249, 115, 22, 0.3) !important; display: flex!important;}
.admin-chat-btn:hover, .admin-chat-btn.active { background: linear-gradient(90deg, #ea580c, #f97316) !important; box-shadow: 0 0 15px rgba(249, 115, 22, 0.4) !important; border-color: transparent !important; }

.chat-main { flex-grow: 1; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 30px; background: rgba(0, 0, 0, 0.2); border-bottom: 1px solid var(--glass-border); flex-wrap: wrap; gap: 15px; }
.header-left { display: flex; flex-direction: column; gap: 5px; }
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-header h2 { font-size: 1.3rem; font-weight: 600; text-shadow: 0 2px 10px rgba(0,0,0,0.5); display: flex; align-items: center; }
.admin-status { font-size: 0.8rem; font-weight: 600; margin-left: 15px; background: rgba(255,255,255,0.05); padding: 6px 14px; border-radius: 20px; border: 1px solid var(--glass-border); display: flex; align-items: center; gap: 6px; }

.chat-messages { flex-grow: 1; padding: 30px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; scroll-behavior: smooth; }
.loading-text { text-align: center; color: var(--text-muted); margin-top: 20px; font-style: italic; animation: pulse 1.5s infinite; }

.message-wrapper { display: flex; margin-bottom: 25px; width: 100%; animation: slideIn 0.3s ease-out forwards; align-items: flex-end; gap: 12px;}
@keyframes slideIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
.message-wrapper.mine { flex-direction: row-reverse; }
.message-content { max-width: 65%; display: flex; flex-direction: column; }
.message-wrapper.mine .message-content { align-items: flex-end; }

.author-name { font-size: 0.75rem; margin-bottom: 8px; color: var(--text-muted); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.message-wrapper.mine .author-name { color: #fdba74; }

.message-text { padding: 15px 22px; font-size: 1rem; line-height: 1.6; word-wrap: break-word; border: 1px solid var(--glass-border); backdrop-filter: blur(10px); }
.message-wrapper.theirs .message-text { background: var(--msg-theirs); border-radius: 20px 20px 20px 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.message-wrapper.mine .message-text { background: var(--msg-mine); color: white; border-radius: 20px 20px 4px 20px; border: none; box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4); }

.chat-input { padding: 25px 30px; background: rgba(0, 0, 0, 0.2); border-top: 1px solid var(--glass-border); display: flex; gap: 15px; }
.chat-input input { flex-grow: 1; padding: 18px 25px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; color: white; font-size: 1.05rem; outline: none; transition: all 0.3s ease; box-shadow: inset 0 2px 5px rgba(0,0,0,0.2); }
.chat-input input:focus { background: rgba(255, 255, 255, 0.06); border-color: rgba(249, 115, 22, 0.5); box-shadow: 0 0 15px rgba(249, 115, 22, 0.2), inset 0 2px 5px rgba(0,0,0,0.2); }

.glow-btn { padding: 0 40px; border: none; border-radius: 16px; background: linear-gradient(135deg, var(--primary-glow), #c2410c); color: white; font-weight: 800; font-size: 1.05rem; cursor: pointer; position: relative; overflow: hidden; transition: all 0.3s ease; box-shadow: 0 0 15px rgba(249, 115, 22, 0.4); letter-spacing: 0.5px; }
.glow-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); transition: all 0.5s ease; }
.glow-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(249, 115, 22, 0.6); }
.glow-btn:hover::before { left: 100%; }
.glow-btn:active { transform: translateY(1px); }

.typing-bubble { display: flex; align-items: center; background: var(--msg-theirs); padding: 14px 20px; border-radius: 20px; width: fit-content; gap: 6px; border: 1px solid var(--glass-border); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.typing-bubble .dot { width: 8px; height: 8px; background-color: var(--text-muted); border-radius: 50%; animation: typingBounce 1.4s infinite ease-in-out both; }
.typing-bubble .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-bubble .dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

.logout-link { background: rgba(231, 76, 60, 0.1); color: #ff6b6b; text-decoration: none; padding: 10px 18px; border-radius: 14px; font-size: 0.85rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; border: 1px solid rgba(231, 76, 60, 0.3); transition: all 0.3s ease; }
.logout-link:hover { background: rgba(231, 76, 60, 0.8); color: white; box-shadow: 0 0 15px rgba(231, 76, 60, 0.4); transform: translateY(-2px); }

.blur-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(20px); z-index: 9999; color: white; justify-content: center; align-items: center; font-size: 1.5rem; font-weight: bold; text-shadow: 0 0 20px #000; }
body.blurred .chat-container { filter: blur(25px); opacity: 0.5; }
body.blurred .bg-orb { display: none; }
body.blurred .blur-overlay { display: flex; }

.epic-badge { position: relative; background: linear-gradient(135deg, #f97316, #ea580c); color: white; font-size: 0.7rem; padding: 3px 10px; border-radius: 12px; margin-left: auto; font-weight: 800; box-shadow: 0 0 10px rgba(249, 115, 22, 0.6); display: flex; align-items: center; justify-content: center; }
.pulse-ring { content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px; border: 2px solid #f97316; border-radius: 14px; animation: pulsate 1.5s infinite ease-out; }
@keyframes pulsate { 0% { transform: scale(0.9); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }

.modal-overlay { position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); z-index: 999999 !important; display: flex; justify-content: center; align-items: center; animation: fadeIn 0.2s ease-out; }
.modal-box { width: 400px; max-width: 90%; padding: 40px; text-align: center; border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.8); }
.modal-icon { font-size: 3rem; margin-bottom: 15px; }
.modal-box h3 { font-size: 1.5rem; margin-bottom: 10px; font-weight: 800; color: white; }
.modal-box p { color: var(--text-muted); margin-bottom: 25px; font-size: 1rem; line-height: 1.5; }
.modal-input { width: 100%; padding: 15px; margin-bottom: 25px; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; color: white; font-size: 1.1rem; text-align: center; outline: none; }
.modal-input:focus { border-color: var(--primary-glow); }
.modal-actions { display: flex; justify-content: center; gap: 15px; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.action-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: all 0.3s ease; border: 1px solid transparent; }
.danger-btn { background: rgba(231, 76, 60, 0.15); color: #ff6b6b; border-color: rgba(231, 76, 60, 0.3); }
.warning-btn { background: rgba(243, 156, 18, 0.15); color: #f1c40f; border-color: rgba(243, 156, 18, 0.3); }
.success-btn { background: rgba(46, 204, 113, 0.15); color: #2ecc71; border-color: rgba(46, 204, 113, 0.3); }
.cancel-btn { background: rgba(255, 255, 255, 0.05); color: #bbb; border-color: rgba(255, 255, 255, 0.1); padding: 0 30px; border-radius: 16px; font-weight: 800;}
.danger-btn:hover { background: rgba(231, 76, 60, 0.9); color: white; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4); }
.warning-btn:hover { background: rgba(243, 156, 18, 0.9); color: white; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4); }
.success-btn:hover { background: rgba(46, 204, 113, 0.9); color: white; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4); }
.cancel-btn:hover { background: rgba(255, 255, 255, 0.15); color: white; transform: translateY(-2px); }

.mute-btn { background: rgba(46, 204, 113, 0.15); color: #2ecc71; border: 1px solid rgba(46, 204, 113, 0.3); padding: 10px 18px; border-radius: 14px; cursor: pointer; font-weight: 800; transition: all 0.3s; letter-spacing: 0.5px; }
.mute-btn.muted { background: rgba(231, 76, 60, 0.15); color: #e74c3c; border-color: rgba(231, 76, 60, 0.3); }
.mute-btn:hover { box-shadow: 0 5px 15px rgba(0,0,0,0.2); transform: translateY(-2px); }

.avatar-container-sidebar { position: relative; width: 32px; height: 32px; flex-shrink: 0; margin-right: 10px; }
.avatar-sidebar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.status-dot { position: absolute; bottom: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #141623; z-index: 2; }
.status-online { background-color: #2ecc71; box-shadow: 0 0 5px rgba(46, 204, 113, 0.5); }
.status-offline { background-color: #95a5a6; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 10px rgba(0,0,0,0.2); flex-shrink: 0;}

.read-receipt { font-size: 0.7rem; color: #7f8c8d; margin-top: 5px; font-weight: bold; opacity: 0.9; text-align: right; }
.spoiler { background-color: #1e1f22; color: transparent; border-radius: 6px; padding: 2px 6px; cursor: pointer; transition: background-color 0.3s, color 0.3s; user-select: none; }
.spoiler:hover { background-color: #2b2d31; }
.spoiler.revealed { background-color: rgba(255,255,255,0.1); color: inherit; }
.admin-note-input { width: 300px; background: transparent; border: none; border-bottom: 1px dashed rgba(255,255,255,0.2); color: #94a3b8; font-size: 0.85rem; padding: 4px 0; outline: none; transition: 0.3s; font-style: italic; }
.admin-note-input:focus { border-bottom-color: var(--primary-glow); color: white; width: 350px;}
.user-mute-icon { font-size: 1rem; cursor: pointer; transition: all 0.3s; opacity: 0.3; filter: grayscale(100%); }
.user-mute-icon:hover { opacity: 0.8; }
.user-mute-icon.active { opacity: 1; filter: none; }

@media (min-width: 1440px) {
    .chat-container { max-width: 1800px; height: 90vh; }
    .sidebar { width: 350px; padding: 35px 25px; }
    .chat-header { padding: 30px 40px; }
    .chat-header h2 { font-size: 1.5rem; }
    .message-text { font-size: 1.1rem; padding: 18px 25px; }
    .chat-input { padding: 30px 40px; }
    .chat-input input { font-size: 1.15rem; padding: 22px 30px; }
    .glow-btn { font-size: 1.15rem; padding: 0 50px; }
    .admin-note-input { width: 400px; font-size: 1rem; }
    .admin-note-input:focus { width: 450px; }
}

@media (max-width: 1024px) {
    .chat-container { width: 95vw; height: 90vh; }
    .sidebar { width: 250px; padding: 20px 15px; }
    .message-content { max-width: 80%; }
}

@media (max-width: 768px) {
    body { height: 100dvh; width: 100vw; overflow: hidden; align-items: center; background: var(--bg-dark); }
    .bg-orb { display: none; }
    .chat-container { width: 100vw !important; height: 100dvh !important; max-width: 100vw !important; border-radius: 0 !important; border: none !important; flex-direction: column !important; margin: 0 !important; }
    .sidebar { width: 100vw !important; height: auto !important; max-height: 160px !important; border-right: none !important; border-bottom: 1px solid var(--glass-border) !important; padding: 10px !important; display: flex !important; flex-direction: column !important; }
    .sidebar h3 { margin: 5px 0 5px 5px !important; font-size: 0.7rem !important; }
    .sidebar ul { display: flex !important; flex-direction: row !important; overflow-x: auto !important; gap: 10px !important; padding-bottom: 5px !important; }
    .sidebar li { min-width: 220px !important; margin-bottom: 0 !important; padding: 10px 15px !important; background: rgba(0,0,0,0.3) !important; }
    .chat-main { flex: 1 !important; width: 100vw !important; display: flex !important; flex-direction: column !important; height: 0 !important; }
    .chat-header { padding: 12px 15px !important; gap: 10px !important; }
    #chat-title { font-size: 1.1rem !important; }
    .admin-note-input { width: 100% !important; font-size: 0.8rem !important;}
    .admin-note-input:focus { width: 100% !important; }
    .header-right { gap: 5px !important; }
    .action-btn, .mute-btn, .logout-link { padding: 6px 10px !important; font-size: 0.75rem !important; }
    .chat-messages { padding: 15px !important; flex: 1 !important; }
    .message-wrapper { margin-bottom: 20px !important; }
    .message-content { max-width: 90% !important; }
    .message-text { padding: 12px 16px !important; font-size: 0.95rem !important; }
    .chat-input { padding: 10px !important; flex-direction: row !important; gap: 10px !important; padding-bottom: env(safe-area-inset-bottom, 15px) !important; }
    .chat-input input { padding: 12px 15px !important; font-size: 1rem !important; border-radius: 12px !important; }
    .glow-btn { padding: 0 20px !important; font-size: 0.9rem !important; border-radius: 12px !important; }
    .modal-box { width: 90% !important; padding: 25px !important; }
    .login-panel { width: 90%; padding: 40px 20px; }
    .glow-text { font-size: 1.8rem; }
}

@media (max-width: 400px) {
    .chat-header { flex-direction: column !important; align-items: flex-start !important; }
    .header-top-row { flex-direction: column !important; gap: 10px !important; }
    .action-btn, .mute-btn, .logout-link { font-size: 0.7rem !important; padding: 5px 8px !important;}
}