:root {
    --bg-deep: #000000;
    --bg-surface: #050505;
    --bg-card: #0a0a0a;
    --text-pure: #ffffff;
    --text-dim: #888888;
    --text-ghost: #444444;
    --accent-neon: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.15);
    --border-subtle: #151515;
    --radius-extreme: 24px;
    --radius-standard: 12px;
}

:root.light-theme {
    --bg-deep: #ffffff;
    --bg-surface: #fcfcfc;
    --bg-card: #ffffff;
    --text-pure: #000000;
    --text-dim: #444444;
    --text-ghost: #aaaaaa;
    --accent-neon: #000000;
    --accent-glow: rgba(0,0,0,0.05);
    --border-subtle: #eeeeee;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-deep) !important;
    color: var(--text-pure);
    font-family: 'Inter', -apple-system, sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-deep) !important;
    height: 100vh;
    overflow-y: auto;
}

/* --- Sidebar Architecture --- */
.sidebar {
    width: 300px;
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn-sm {
    background: transparent;
    border: none;
    color: var(--text-ghost);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-sm:hover {
    background: var(--bg-card);
    color: var(--text-pure);
}

.new-chat-btn {
    flex: 1;
    height: 44px;
    background: var(--text-pure);
    color: var(--bg-deep);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.new-chat-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.session-search-wrapper {
    position: relative;
    margin-top: 5px;
}

.session-search-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    color: var(--text-ghost);
}

#sessionSearch {
    width: 100%;
    padding: 10px 10px 10px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-pure);
    font-size: 13px;
    outline: none;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
}

.chat-item {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-dim);
    text-align: left;
    font-size: 13px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-pure);
}

.chat-item.active {
    background: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-pure);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
}

.footer-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-ghost);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.footer-btn:hover {
    color: #ff4444;
}

/* --- Chat Interface --- */
.chat-header {
    height: 70px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-deep);
    z-index: 500;
    position: sticky;
    top: 0;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-pure);
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 992px) {
    .menu-btn { display: block; }
    .sidebar { position: fixed; transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); }
    .chat-header { padding: 0 16px; }
}

.header-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff00;
    box-shadow: 0 0 8px #00ff00;
}

.chat-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.quick-prefs {
    display: flex;
    gap: 8px;
}

.icon-toggle {
    width: 42px;
    height: 42px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-ghost);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.icon-toggle::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: 0.3s;
}

.icon-toggle:hover {
    color: var(--text-pure);
    border-color: var(--text-pure);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.icon-toggle:hover::after {
    border-color: rgba(255, 255, 255, 0.5);
    filter: blur(2px);
}

.icon-toggle.active {
    background: var(--text-pure);
    color: var(--bg-deep);
    border-color: var(--text-pure);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.icon-toggle i {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.icon-toggle:hover i {
    transform: scale(1.15);
}

.nav-link {
    color: var(--text-ghost);
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.nav-link:hover { color: var(--text-pure); }

/* --- Messages Container --- */
.messages-container {
    flex: 1;
    overflow-y: visible; /* Allow main to scroll */
    padding: 60px 24px;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.message {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 32px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user .message-avatar {
    background: var(--text-pure);
    color: var(--bg-deep);
}

.message-text {
    font-size: 16px;
    line-height: 1.8;
    flex: 1;
}

/* --- Input Area --- */
.input-area {
    padding: 40px 24px;
    background: var(--bg-deep) !important;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.input-wrapper {
    max-width: 1000px;
    margin: 0 auto;
}

.input-container {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 12px 24px;
    gap: 16px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-pure);
    font-size: 16px;
    padding: 8px 0;
    resize: none;
    max-height: 200px;
    font-family: inherit;
}

.aux-btn,
.send-btn {
    background: transparent;
    border: none;
    color: var(--text-ghost);
    cursor: pointer;
    padding: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aux-btn:hover {
    color: var(--text-pure);
    transform: translateY(-2px);
    background: var(--bg-surface);
}

.mic-btn.recording {
    background: #ff4444 !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
    animation: Pulse 1.5s infinite;
}

@keyframes Pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 30px rgba(255, 68, 68, 0.6); }
    100% { transform: scale(1); }
}

/* Ghost Placeholder styling */
.message-input::placeholder {
    color: rgba(255, 255, 255, 0.15);
    transition: color 0.3s ease;
    font-weight: 500;
}

.message-input:focus::placeholder {
    color: transparent;
}

.send-btn {
    background: var(--text-pure);
    color: var(--bg-deep);
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

.send-btn:disabled {
    opacity: 0.1;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 0 0 0;
    font-size: 10px;
    color: var(--text-ghost);
}

/* --- Professional Voice Overlay --- */
.voice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(40px);
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.voice-overlay.active {
    display: flex;
    opacity: 1;
}

.voice-wave-container {
    width: 100%;
    max-width: 800px;
    height: 200px;
    position: relative;
}

#voiceWave {
    width: 100%;
    height: 100%;
}

.voice-status {
    font-size: 24px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 4px;
    animation: statusBlink 1.5s infinite;
}

.voice-tip {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: 600;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Slash Command Menu --- */
.command-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin-bottom: 15px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    padding: 8px;
    animation: menuSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.command-menu.show { display: flex; }

.command-item {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 12px;
}

.command-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.command-icon {
    width: 18px;
    height: 18px;
    color: var(--text-dim);
}

.command-key {
    font-weight: 800;
    color: #fff;
    font-size: 14px;
    min-width: 100px;
}

.command-desc {
    font-size: 12px;
    color: var(--text-ghost);
    flex: 1;
}

@keyframes menuSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.drawing-pulse {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 600;
}

.pulse-icon {
    width: 24px;
    height: 24px;
    animation: iconPulse 1.5s infinite;
}

@keyframes iconPulse {
    0% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); color: var(--text-pure); }
    100% { opacity: 0.4; transform: scale(0.9); }
}

/* --- Suggestions --- */
.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.suggestion-chip {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-chip:hover {
    background: var(--text-pure);
    color: var(--bg-deep);
    border-color: var(--text-pure);
    transform: translateY(-2px);
}

.suggestion-chip i { width: 14px; height: 14px; opacity: 0.7; }

/* --- BRAND FOOTER --- */
.footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: 80px 40px 40px;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 80px;
    margin-bottom: 60px;
}

.footer-brand-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-pure);
}

.footer-description {
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 15px;
    max-width: 400px;
}

.creator-badge {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.badge-label { font-size: 11px; color: var(--text-ghost); font-weight: 700; text-transform: uppercase; }
.badge-name { font-weight: 700; color: var(--text-pure); }

.footer-nav-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.footer-column h4 {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-ghost);
    text-transform: uppercase;
    margin-bottom: 24px;
    letter-spacing: 1px;
}

.footer-column a {
    display: block;
    color: var(--text-dim);
    text-decoration: none;
    margin-bottom: 12px;
    font-size: 14px;
    transition: 0.2s;
}

.footer-column a:hover { color: var(--text-pure); }

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 40px;
    border-top: 1px solid var(--border-subtle);
}

.footer-copyright {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-ghost);
    font-size: 13px;
    font-weight: 600;
}

.separator { width: 4px; height: 4px; background: var(--text-ghost); border-radius: 50%; opacity: 0.5; }

.social-link {
    color: var(--text-ghost);
    transition: 0.2s;
}

.social-link:hover { color: var(--text-pure); }

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; gap: 40px; }
    .footer-nav-section { grid-template-columns: repeat(2, 1fr); }
    .footer { padding: 40px 20px; }
}

/* Code Highlighting */
pre {
    background: #0d1117 !important;
    border-radius: 12px;
    padding: 24px;
    margin: 1.5em 0;
    border: 1px solid var(--border-subtle);
}

.code-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-ghost);
}