:root {
    --bg-dark: #070913;
    --bg-panel: #0d1127;
    --bg-glass: rgba(13, 17, 39, 0.65);
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-glass-focus: rgba(147, 51, 234, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #9333ea;
    --primary-gradient: linear-gradient(135deg, #a855f7 0%, #701a75 100%);
    --accent-glow: rgba(168, 85, 247, 0.4);
    --user-msg-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 280px;
    --header-height: 70px;
}

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

body {
    font-family: 'Inter', 'Be Vietnam Pro', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    background: radial-gradient(circle at 50% 0%, #1e1145 0%, #070913 70%);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition-smooth);
    z-index: 10;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    position: relative;
}

.logo-glow {
    position: absolute;
    width: 32px;
    height: 32px;
    background: var(--primary);
    filter: blur(15px);
    opacity: 0.6;
    border-radius: 50%;
    z-index: -1;
}

.logo-icon {
    font-size: 1.4rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navigation Tabs inside Sidebar */
.nav-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-glass);
}

.nav-tab-btn {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.nav-tab-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-tab-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed var(--border-glass-focus);
    background: rgba(147, 51, 234, 0.05);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
    margin-top: 8px;
}

.new-chat-btn:hover {
    background: rgba(147, 51, 234, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.2);
}

.history-section, .poster-sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding-left: 10px;
    margin-bottom: 4px;
}

.chat-list, .poster-tools-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-item, .poster-tool-item {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

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

.chat-item.active, .poster-tool-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-weight: 500;
}

.chat-item.active::before, .poster-tool-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: var(--primary-gradient);
    border-radius: 0 4px 4px 0;
}

.chat-item-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.chat-item i, .poster-tool-item i {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.chat-item.active i, .poster-tool-item.active i {
    color: #a855f7;
}

.chat-item-actions {
    display: none;
    gap: 4px;
}

.chat-item:hover .chat-item-actions {
    display: flex;
}

.chat-item-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.chat-item-actions button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.chat-item-actions button.delete-btn:hover {
    color: #ef4444;
}

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

.footer-action-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.footer-action-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border-color: var(--border-glass-focus);
}

/* Main Content Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background: transparent;
    overflow: hidden;
}

.view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.view-container.active {
    display: flex !important;
}

/* Header Styling */
.app-header {
    height: var(--header-height);
    padding: 0 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.chat-meta {
    display: flex;
    flex-direction: column;
}

.chat-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.chat-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.model-selector-wrapper {
    position: relative;
}

.model-select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
}

.model-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.15);
}

.model-selector-wrapper::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--text-secondary);
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.header-btn {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.header-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Chat Area & Welcome Styling */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.welcome-container {
    max-width: 800px;
    margin: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.welcome-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.welcome-icon {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: 2;
}

.pulse-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 50%;
    filter: blur(25px);
    opacity: 0.45;
    animation: pulse 3s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.3; }
    100% { transform: scale(1.1); opacity: 0.55; }
}

.welcome-container h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 30%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-desc {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 580px;
    line-height: 1.6;
    margin-bottom: 40px;
}

.quick-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    width: 100%;
}

.prompt-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.prompt-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass-focus);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card-icon {
    font-size: 1.25rem;
    color: #a855f7;
    margin-bottom: 12px;
}

.prompt-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.prompt-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Messages container */
.messages-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 60px;
}

.message-wrapper {
    display: flex;
    gap: 16px;
    width: 100%;
    animation: fadeInUp 0.3s ease forwards;
}

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

.message-wrapper.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.message-wrapper.user .message-avatar {
    background: var(--user-msg-gradient);
    color: white;
}

.message-wrapper.assistant .message-avatar {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 0 10px var(--accent-glow);
}

.message-bubble {
    max-width: calc(100% - 52px);
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 0.95rem;
    position: relative;
}

.message-wrapper.user .message-bubble {
    background: var(--user-msg-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-wrapper.assistant .message-bubble {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Message Markdown Styles */
.message-bubble p {
    margin-bottom: 12px;
}
.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: #e2e8f0;
}

.message-bubble pre {
    background: #090c15;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin: 14px 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.message-bubble pre code {
    display: block;
    padding: 16px;
    background: transparent;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.copy-code-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
    padding: 4px 8px;
    border-radius: 4px;
}

.copy-code-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.message-bubble ul, .message-bubble ol {
    margin: 10px 0 10px 20px;
}

.message-bubble li {
    margin-bottom: 6px;
}

.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.9rem;
}

.message-bubble th, .message-bubble td {
    border: 1px solid var(--border-glass);
    padding: 8px 12px;
    text-align: left;
}

.message-bubble th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
}

.message-action-bar {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: var(--transition-smooth);
}

.message-wrapper:hover .message-action-bar {
    opacity: 1;
}

.msg-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.msg-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Typing Indicator Styling */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-left: 52px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.3s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Input Area Styling */
.input-area {
    padding: 16px 24px 24px;
    background: linear-gradient(180deg, transparent 0%, var(--bg-dark) 40%);
    position: relative;
    z-index: 4;
    flex-shrink: 0;
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    padding: 10px 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

.input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.15), 0 -4px 30px rgba(0, 0, 0, 0.2);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 200px;
    min-height: 24px;
    padding: 4px 0;
    line-height: 1.5;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.action-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    animation: voicePulse 1.5s infinite;
}

@keyframes voicePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.send-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 0 10px var(--accent-glow);
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.input-footer-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ========================================================
   AUTO-POSTER WORKSPACE STYLES
   ======================================================== */
.poster-workspace {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    width: 100%;
}

.poster-layout {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
    width: 100%;
}

.poster-left-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 360px; /* Safe width for content editor */
}

.poster-right-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    min-width: 300px; /* Safe width for platform selectors and previews */
}

.panel-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.panel-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 10px;
}

.text-purple { color: #c084fc; }
.text-blue { color: #60a5fa; }
.text-green { color: #34d399; }
.text-orange { color: #fb923c; }

.mt-20 { margin-top: 20px; }
.mt-10 { margin-top: 10px; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group textarea, .form-group select {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
}

.form-group textarea:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.15);
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.05rem;
    border-radius: 12px;
}

/* Platform selectors */
.platforms-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.platform-checkbox-label {
    cursor: pointer;
    display: block;
}

.platform-checkbox-label input[type="checkbox"] {
    display: none;
}

.platform-card-visual {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.01);
    transition: var(--transition-smooth);
    min-width: 0;
}

.platform-checkbox-label:hover .platform-card-visual {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

.platform-checkbox-label input[type="checkbox"]:checked + .platform-card-visual {
    background: rgba(147, 51, 234, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.15);
}

.platform-card-visual i {
    font-size: 1.8rem;
}

.telegram-color { color: #0088cc; }
.facebook-color { color: #1877f2; }

.platform-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.platform-info .p-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.platform-info .p-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.p-status.active {
    color: #34d399 !important;
}

/* Post preview box styling */
.post-preview-box {
    background: #18191a; /* mimicking FB dark post */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 16px;
    color: #e4e6eb;
}

.preview-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.preview-author-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e4e6eb;
}

.preview-author-info span {
    font-size: 0.75rem;
    color: #b0b3b8;
}

.preview-body {
    font-size: 0.92rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.publish-feedback {
    font-size: 0.85rem;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    display: none;
}

.publish-feedback.success {
    display: block;
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.publish-feedback.error {
    display: block;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ========================================================
   MODAL TABS AND CHANNEL CONFIGS
   ======================================================== */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-glass);
    padding: 0 24px;
}

.settings-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

.settings-tab-btn:hover {
    color: var(--text-primary);
}

.settings-tab-btn.active {
    color: var(--primary);
}

.settings-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-gradient);
}

.settings-section-divider {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Modal adjustments */
.modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

/* ========================================================
   MODAL / OTHER BASIC LAYOUTS
   ======================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(7, 9, 19, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
    z-index: 100;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass-focus);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(147, 51, 234, 0.1);
    transform: scale(0.9);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.modal-header h3 i {
    color: #a855f7;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-group input[type="text"],
.settings-group input[type="password"],
.settings-group textarea {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
}

.settings-group input:focus,
.settings-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.15);
}

.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-toggle button {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.input-with-toggle button:hover {
    color: var(--text-primary);
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.help-text a {
    color: #a855f7;
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.settings-group.row {
    flex-direction: row;
    gap: 16px;
}

.settings-group.row .field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: var(--transition-smooth);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.backup-actions .btn-group {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-glass-focus);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
}

.chat-rename-input {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid var(--primary) !important;
    border-radius: 4px;
    color: white;
    padding: 2px 6px;
    font-size: 0.9rem;
    outline: none;
    width: 100%;
}

/* Responsive styles */
@media (max-width: 1024px) {
    .poster-layout {
        flex-direction: column;
        align-items: stretch;
    }
    .poster-right-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.collapsed {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .main-content {
        width: 100vw;
    }
    
    .welcome-container h1 {
        font-size: 1.75rem;
    }
    
    .quick-prompts {
        grid-template-columns: 1fr;
    }
}

/* ========================================================
   CHANNEL CONFIG CARD STYLES
   ======================================================== */
.config-channel-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    transition: var(--transition-smooth);
}

.config-channel-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.config-channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-weight: 700;
    font-size: 0.95rem;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-with-icon i {
    font-size: 1.2rem;
}

.config-channel-card .badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    font-weight: 600;
}

.config-channel-card .badge.active {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.25);
}

.config-channel-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.config-channel-body .settings-group {
    gap: 4px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-right: 6px;
}

.mt-16 {
    margin-top: 16px;
}

/* --- SECOND BRAIN STYLES --- */

/* RAG Switch in Header */
.brain-query-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    transition: var(--transition-smooth);
}

.brain-query-toggle-wrapper:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(147, 51, 234, 0.2);
}

.brain-toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.brain-query-toggle-wrapper input:checked ~ .brain-toggle-label {
    color: #a855f7;
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .4s;
    border-radius: 34px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch-container input:checked + .switch-slider {
    background: var(--primary-gradient);
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(16px);
}

/* Sidebar Notes Section */
.brain-sidebar-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    padding: 10px 14px;
}

.brain-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.add-note-btn-small {
    background: rgba(147, 51, 234, 0.15);
    border: 1px solid rgba(147, 51, 234, 0.3);
    color: #a855f7;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.add-note-btn-small:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(147, 51, 234, 0.3);
}

.note-search-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.note-search-wrapper input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 12px 8px 32px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.note-search-wrapper input:focus {
    outline: none;
    border-color: var(--border-glass-focus);
    background: rgba(255, 255, 255, 0.07);
}

.note-search-wrapper .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.note-tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    max-height: 70px;
    overflow-y: auto;
    padding-bottom: 4px;
}

.tag-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tag-badge:hover, .tag-badge.active {
    background: rgba(147, 51, 234, 0.15);
    color: #a855f7;
    border-color: rgba(147, 51, 234, 0.3);
}

.note-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 2px;
}

.note-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.note-item:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: var(--transition-smooth);
}

.note-item.active {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(147, 51, 234, 0.3);
}

.note-item.active:before {
    background: var(--primary);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.note-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.note-item-pin {
    font-size: 0.75rem;
    color: #ea580c;
}

.note-item-snippet {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.note-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.note-item-tags {
    display: flex;
    gap: 4px;
    overflow: hidden;
}

.note-item-tag {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.note-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition-smooth);
}

.note-item:hover .note-item-actions {
    opacity: 1;
}

.note-item-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.75rem;
    transition: var(--transition-smooth);
}

.note-item-actions button:hover {
    color: #ef4444;
}

/* Brain Main Workspace */
.brain-workspace {
    padding: 20px;
    flex-grow: 1;
    overflow: hidden;
    height: calc(100vh - var(--header-height));
}

.brain-layout {
    display: flex;
    gap: 20px;
    height: 100%;
}

.brain-left-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}

.brain-right-panel {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 280px;
    height: 100%;
    overflow-y: auto;
}

/* Note Editor Card */
.note-editor-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.note-editor-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-title-field {
    width: 100%;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: inherit;
}

.note-title-field:focus {
    outline: none;
}

.note-editor-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    align-items: center;
}

.note-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pin-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
}

.color-options {
    display: flex;
    gap: 6px;
    align-items: center;
}

.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-smooth);
}

.color-dot.active {
    border-color: white;
    transform: scale(1.15);
}

.note-tags-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 4px 10px;
}

.note-tags-wrapper i {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.note-tags-wrapper input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    width: 100%;
}

.note-tags-wrapper input:focus {
    outline: none;
}

.note-editor-body {
    padding: 10px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.editor-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 6px;
}

.editor-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.editor-tab-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.editor-tab-btn.active {
    background: rgba(147, 51, 234, 0.1);
    color: #a855f7;
    font-weight: 600;
}

.editor-content-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#note-content-editor {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    overflow-y: auto;
}

#note-content-editor:focus {
    outline: none;
}

.note-preview-pane {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    line-height: 1.6;
    padding: 10px 0;
    color: #e2e8f0;
}

.note-preview-pane h1, .note-preview-pane h2, .note-preview-pane h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 700;
}

.note-preview-pane h1 { font-size: 1.5rem; color: #a855f7; }
.note-preview-pane h2 { font-size: 1.25rem; }
.note-preview-pane h3 { font-size: 1.1rem; }

.note-preview-pane p {
    margin-bottom: 12px;
}

.note-preview-pane ul, .note-preview-pane ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.note-preview-pane code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

/* AI Note Actions and Chat styling */
.ai-brain-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.ai-brain-actions button {
    padding: 10px 14px;
}

.btn-subtext {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
    text-align: left;
}

.note-ai-chat-box {
    display: flex;
    flex-direction: column;
    height: 300px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    overflow: hidden;
}

.note-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-chat-message {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.4;
    max-width: 85%;
}

.note-chat-message.assistant {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.note-chat-message.user {
    background: var(--user-msg-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.note-chat-input-wrapper {
    display: flex;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-glass);
}

.note-chat-input-wrapper input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
}

.note-chat-input-wrapper input:focus {
    outline: none;
    border-color: var(--border-glass-focus);
}

.note-chat-input-wrapper button {
    background: var(--primary-gradient);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    margin-left: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.note-chat-input-wrapper button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--accent-glow);
}

.note-title-wrapper-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.action-btn-small {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.action-btn-small:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(147, 51, 234, 0.3);
}

.action-btn-small.recording {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

.editor-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.tabs-left {
    display: flex;
    gap: 4px;
}

.settings-tab-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* ========================================================
   CONSOLE MULTI-AGENT NEW TAB STYLES
   ======================================================== */

/* Dashboard Stats Cards */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}

.stat-card {
    background: rgba(13, 17, 39, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Cyber-glowing border styles */
.stat-card.blue { border-color: #0088cc; box-shadow: 0 0 15px rgba(0, 136, 204, 0.15); }
.stat-card.cyan { border-color: #00b4d8; box-shadow: 0 0 15px rgba(0, 180, 216, 0.15); }
.stat-card.orange { border-color: #ff7a00; box-shadow: 0 0 15px rgba(255, 122, 0, 0.15); }
.stat-card.purple { border-color: #7000ff; box-shadow: 0 0 15px rgba(112, 0, 255, 0.15); }

.stat-card .icon {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2.2rem;
    opacity: 0.15;
}

.stat-card.blue .icon { color: #0088cc; }
.stat-card.cyan .icon { color: #00b4d8; }
.stat-card.orange .icon { color: #ff7a00; }
.stat-card.purple .icon { color: #7000ff; }

.stat-card .number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

/* Leads Table style */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.leads-table th, .leads-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.85rem;
    white-space: nowrap;
}

.leads-table th {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
}

.leads-table tbody tr {
    transition: var(--transition-smooth);
}

.leads-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.leads-table td {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges for Leads */
.lead-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.lead-badge.locdao {
    background: rgba(0, 180, 216, 0.1);
    color: #00b4d8;
    border-color: rgba(0, 180, 216, 0.2);
}

.lead-badge.goebai {
    background: rgba(255, 122, 0, 0.1);
    color: #ff7a00;
    border-color: rgba(255, 122, 0, 0.2);
}

.lead-badge.unknown {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-color: var(--border-glass);
}

/* Sales Classification result card */
.classification-result-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 0;
}

.classification-badge {
    font-size: 1.25rem;
    font-weight: 800;
    padding: 10px 24px;
    border-radius: 12px;
    border: 2px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
    width: 100%;
    transition: var(--transition-smooth);
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.classification-badge.locdao {
    border-color: #00b4d8;
    color: #00b4d8;
    box-shadow: 0 0 15px rgba(0, 180, 216, 0.2);
    background: rgba(0, 180, 216, 0.05);
}

.classification-badge.goebai {
    border-color: #ff7a00;
    color: #ff7a00;
    box-shadow: 0 0 15px rgba(255, 122, 0, 0.2);
    background: rgba(255, 122, 0, 0.05);
}

.sub-heading {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: left;
    color: var(--text-primary);
}

.text-secondary-p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: left;
}

/* Second Brain Knowledge Cards list */
.knowledge-cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
}

.knowledge-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.knowledge-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.1);
}

.k-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.k-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.k-category {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.k-category.locdao { background: rgba(0, 180, 216, 0.1); color: #00b4d8; }
.k-category.goebai { background: rgba(255, 122, 0, 0.1); color: #ff7a00; }
.k-category.chung { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); }

.k-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: pre-wrap;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* System Console Logs */
.logs-container {
    background: #090b14;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    height: 380px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-row {
    font-size: 0.78rem;
    line-height: 1.4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 4px;
    display: flex;
    gap: 6px;
}

.log-time { color: var(--text-muted); }
.log-level { font-weight: bold; }
.log-level.info { color: #34d399; }
.log-level.warn { color: #fbbf24; }
.log-level.error { color: #f87171; }
.log-text { color: #e2e8f0; }

/* Second Brain Switch in Header */
.brain-retrieval-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.brain-retrieval-switch i {
    color: #c084fc;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: 1px solid var(--border-glass);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.w-100 { width: 100%; }
.mt-16 { margin-top: 16px; }

/* Login Screen Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 10, 15, 0.96);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-card {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 0 30px rgba(147, 51, 234, 0.25);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.login-logo-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(147, 51, 234, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.3);
}
.login-shield-icon {
    font-size: 28px;
    color: #a855f7;
}
.login-card h2 {
    font-size: 22px;
    color: #fff;
    font-weight: 600;
}
.login-card p {
    font-size: 14px;
    color: #94a3b8;
}
.login-input-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
    margin-top: 8px;
}
.login-input-group input {
    width: 100%;
    padding: 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    text-align: center;
}
.login-input-group input:focus {
    border-color: #a855f7;
    outline: none;
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.3);
}
.login-error-msg {
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
}

/* ========================================================
   VIDEO STUDIO LAYOUT STYLES
   ======================================================== */
.queue-files-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.queue-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.file-list-box {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.no-files-placeholder {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 10px;
    font-style: italic;
}

.queue-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    font-size: 0.82rem;
    transition: var(--transition-smooth);
}

.queue-file-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.file-info-group {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.file-info-group i {
    font-size: 1rem;
    flex-shrink: 0;
}

.file-info-group .file-name {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.glow-effect {
    position: relative;
    overflow: hidden;
    transition: 0.3s;
}

.glow-effect:hover {
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.7);
    transform: scale(1.01);
}

