/* Hogdark IRC Chat UI */
:root {
    --chat-bg: rgba(11, 15, 20, 0.95);
    --chat-border: #C8A96A; /* Hogdark Gold */
    --chat-text: #e0e0e0;
    --chat-accent: #0ff;
    --chat-width: 350px;
    --chat-header-height: 50px;
    --glass-blur: 10px;
}

/* Sidebar Toggle Button (Visible when chat is closed) */
#chat-sidebar-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(11, 15, 20, 0.9);
    border: 1px solid var(--chat-border);
    border-right: none;
    padding: 20px 8px;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    cursor: pointer;
    z-index: 9998;
    color: var(--chat-border);
    box-shadow: -2px 0 15px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-weight: bold;
    letter-spacing: 3px;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

#chat-sidebar-toggle:hover {
    background: rgba(200, 169, 106, 0.2);
    padding-right: 12px; /* Slight expansion on hover */
    box-shadow: -2px 0 20px rgba(200, 169, 106, 0.3);
}

#chat-sidebar-toggle.hidden {
    right: -60px; /* Hide off-screen */
}

/* Notification Glow for Toggle Button */
#chat-sidebar-toggle.notification-glow {
    animation: sidebar-glow 1.5s infinite alternate;
    border-color: #ff3333;
    color: #ff3333;
}

@keyframes sidebar-glow {
    from { box-shadow: -2px 0 10px rgba(255, 0, 0, 0.2); }
    to { box-shadow: -2px 0 25px rgba(255, 0, 0, 0.8); }
}

/* Chat Container (Sidebar) */
#hogdark-chat-container {
    position: fixed;
    top: 0;
    right: -360px; /* Hidden by default */
    width: var(--chat-width);
    height: 100%;
    background: var(--chat-bg);
    border-left: 1px solid var(--chat-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    z-index: 9999;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.8);
}

#hogdark-chat-container.open {
    right: 0;
}

/* Header */
#chat-header {
    height: var(--chat-header-height);
    background: linear-gradient(90deg, rgba(200, 169, 106, 0.1), rgba(0,0,0,0.3));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    border-bottom: 1px solid rgba(200, 169, 106, 0.3);
    flex-shrink: 0;
}

#chat-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #555; /* Connecting/Offline */
    margin-right: 10px;
    box-shadow: 0 0 5px currentColor;
    transition: all 0.3s;
}

#chat-status-indicator.connected {
    background-color: #0f0; /* Online */
    box-shadow: 0 0 8px #0f0;
}

#chat-title {
    font-weight: 600;
    color: var(--chat-border);
    font-size: 0.95rem;
    flex-grow: 1;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px rgba(200, 169, 106, 0.3);
}

#chat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chat-users-btn, #chat-close-btn {
    background: none;
    border: none;
    color: var(--chat-border);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-users-btn:hover, #chat-close-btn:hover {
    background: rgba(200, 169, 106, 0.1);
}

/* Chat Body (Messages + User List) */
#chat-body {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    display: flex;
}

#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}
#chat-messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
}
#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(200, 169, 106, 0.3);
    border-radius: 3px;
}

/* Messages */
.chat-msg {
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    color: #ccc;
    padding: 2px 0;
}

.chat-msg.system {
    color: #888;
    font-style: italic;
    font-size: 0.85rem;
    border-left: 2px solid #555;
    padding-left: 8px;
}

.chat-msg .timestamp {
    color: #666;
    font-size: 0.75rem;
    margin-right: 6px;
    user-select: none;
}

.chat-msg .nick {
    font-weight: bold;
    color: var(--chat-accent);
    cursor: pointer;
}

.chat-msg .nick:hover {
    text-decoration: underline;
}

/* User List (Overlay) */
#chat-user-list {
    position: absolute;
    top: 0;
    right: 0;
    width: 180px;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    border-left: 1px solid rgba(200, 169, 106, 0.3);
    z-index: 10;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

#chat-user-list.hidden {
    transform: translateX(100%);
    display: flex; /* Override display:none to allow transition, but translateX moves it out */
}

.user-list-header {
    padding: 10px;
    background: rgba(200, 169, 106, 0.1);
    font-weight: bold;
    border-bottom: 1px solid rgba(200, 169, 106, 0.2);
    text-align: center;
    color: var(--chat-border);
}

#users-ul {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

#users-ul li {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

#users-ul li:hover {
    background: rgba(255,255,255,0.05);
}

#users-ul li.op { color: #ffeb3b; }
#users-ul li.voice { color: #0f0; }

/* Input Area */
#chat-input-area {
    padding: 10px;
    background: rgba(0,0,0,0.5);
    border-top: 1px solid rgba(200, 169, 106, 0.2);
    flex-shrink: 0;
}

#chat-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}

#chat-input:focus {
    border-color: var(--chat-border);
    background: rgba(0,0,0,0.3);
    box-shadow: 0 0 10px rgba(200, 169, 106, 0.1);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #hogdark-chat-container {
        width: 100%; /* Full width on mobile */
        right: -100%;
    }
    
    #hogdark-chat-container.open {
        right: 0;
    }

    #chat-sidebar-toggle {
        top: 60%; /* Lower it a bit on mobile to avoid overlapping other floating buttons */
        padding: 15px 5px;
    }
}
