* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    height: 100vh;
    background: radial-gradient(ellipse at center, #0a0a0a 10%, #000000 90%);
    font-family: 'Share Tech Mono', monospace;
    color: #ff4d4d;
    overflow: hidden;
}

#app-container {
    display: flex;
    height: 100vh;
}

/* Chat Sidebar */
#chat-sidebar {
    width: 280px;
    background: #0a0000;
    border-right: 1px solid #330000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(255, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

#chat-sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #330000;
}

#newChatBtn {
    width: 100%;
    padding: 12px;
    background: #330000;
    color: #ff4d4d;
    border: 1px solid #660000;
    font-weight: bold;
    font-family: 'Share Tech Mono', monospace;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
    transition: all 0.2s;
}

#newChatBtn:hover {
    background: #550000;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

#chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #1a0000;
    transition: background 0.2s;
    position: relative;
}

.chat-item:hover {
    background: #1a0000;
}

.chat-item.active {
    background: #330000;
    border-left: 3px solid #ff4d4d;
}

.chat-title {
    color: #ff4d4d;
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    color: #666;
    font-size: 0.7rem;
}

.chat-actions {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-item:hover .chat-actions {
    opacity: 1;
}

.delete-chat {
    background: none;
    border: none;
    color: #ff6666;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
}

.delete-chat:hover {
    color: #ff0000;
}

#loading-chats {
    color: #666;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

/* Main Chat Area */
#core-frame {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #330000;
    background: #000;
    box-shadow: 0 0 40px #ff000033, 0 0 8px #ff000022 inset;
}

.hal-header {
    padding: 20px;
    background: #0b0000;
    border-bottom: 1px solid #330000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hal-boot-sequence .boot-line {
    color: #ff3333;
    font-size: 0.9rem;
    text-shadow: 0 0 3px #ff0000;
    line-height: 1.4;
}

.hal-symbol {
    font-size: 2rem;
    color: #ff1a1a;
    text-align: center;
    text-shadow: 0 0 10px #ff0000;
}

#top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

#toggleSidebar {
    background: #330000;
    color: #ff4d4d;
    border: 1px solid #660000;
    padding: 5px 10px;
    font-weight: bold;
    font-family: 'Share Tech Mono', monospace;
    cursor: pointer;
    box-shadow: 0 0 5px red;
    border-radius: 4px;
}

#voice-select-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#voice-select-container label {
    color: #ff4d4d;
    text-shadow: 0 0 2px red;
}

#voice-select-container select {
    background: black;
    color: #ffcccc;
    border: 1px solid #660000;
    padding: 4px 8px;
    font-family: 'Share Tech Mono', monospace;
    border-radius: 4px;
}

#chat-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #000;
}

.msg-bubble {
    max-width: 80%;
    padding: 12px 16px;
    font-size: 0.95rem;
    background: #140000;
    border: 1px solid #440000;
    color: #ffcccc;
    border-radius: 8px;
    box-shadow: 0 0 6px #ff000025;
    line-height: 1.4;
}

.msg-client {
    align-self: flex-end;
    background: #330000;
    color: #ffdada;
}

.msg-system {
    align-self: flex-start;
    background: #1a0000;
    color: #ff4d4d;
}

#welcome-message {
    align-self: center;
    max-width: 100%;
    text-align: center;
    opacity: 0.7;
}

#chat-input {
    display: flex;
    padding: 14px 20px;
    background-color: #0b0000;
    border-top: 1px solid #330000;
    gap: 10px;
}

#input {
    flex: 1;
    padding: 10px;
    background-color: #1a0000;
    color: #ffcccc;
    border: 1px solid #440000;
    font-size: 1rem;
    outline: none;
    border-radius: 6px;
}

#input:focus {
    border-color: #660000;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
}

#send {
    padding: 0 16px;
    background: #330000;
    border: 1px solid #660000;
    color: #ff5555;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
    text-shadow: 0 0 3px #ff0000;
    transition: all 0.2s;
}

#send:hover {
    background: #550000;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

#send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #app-container {
        flex-direction: column;
    }

    #chat-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        width: 250px;
    }

    #chat-sidebar.hidden {
        transform: translateX(-100%);
    }

    #core-frame {
        width: 100%;
    }
}
