/* NEXUS AI Web Application - Professional Light/Dark Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== ADVANCED LIGHT THEME (DEFAULT) ===== */
:root {
    --primary-color: #22C55E;
    --primary-dark: #16A34A;
    --primary-light: #DCFCE7;
    --secondary-color: #15803D;
    --accent-color: #22C55E;
    --success-color: #22C55E;
    --warning-color: #EA580C;
    --danger-color: #E81123;
    
    /* Advanced Light Theme Colors - Apple Green, Black & White */
    --bg-primary: #000000;
    --bg-secondary: #1A1A1A;
    --bg-tertiary: #2A2A2A;
    --bg-quaternary: #3A3A3A;
    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;
    --text-tertiary: #A0A0A0;
    --text-quarternary: #808080;
    --border-light: #22C55E;
    --border-dark: #15803D;
    --border-accent: #22C55E;
    
    --user-msg-bg: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    --ai-msg-bg: linear-gradient(135deg, #1A1A1A 0%, #2A2A2A 100%);
    --sidebar-bg: #000000;
    --header-bg: linear-gradient(135deg, #000000 0%, #1A1A1A 100%);
    
    --shadow-sm: 0 2px 8px rgba(34, 197, 94, 0.1), 0 1px 2px rgba(34, 197, 94, 0.05);
    --shadow-md: 0 4px 12px rgba(34, 197, 94, 0.15), 0 2px 4px rgba(34, 197, 94, 0.1);
    --shadow-lg: 0 10px 20px rgba(34, 197, 94, 0.2), 0 4px 6px rgba(34, 197, 94, 0.1);
    --shadow-xl: 0 20px 30px rgba(34, 197, 94, 0.25), 0 10px 15px rgba(34, 197, 94, 0.15);
    
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== DARK THEME ===== */
body.theme-dark {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --bg-quaternary: #475569;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-tertiary: #94A3B8;
    --text-quarternary: #64748B;
    --border-light: #334155;
    --border-dark: #1E293B;
    --border-accent: #0078D4;
    
    --user-msg-bg: linear-gradient(135deg, #0078D4 0%, #1084D6 100%);
    --ai-msg-bg: linear-gradient(135deg, #1E293B 0%, #334155 100%);
    --sidebar-bg: #0F172A;
    --header-bg: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    
    --primary-color: #0078D4;
    --primary-dark: #005A9E;
    --accent-color: #6B21A8;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4), 0 10px 10px rgba(0, 0, 0, 0.15);
    
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: var(--transition);
}

.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: 18px;
    border-bottom: 1px solid var(--border-light);
    background: var(--header-bg);
}

.new-chat-btn {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #7822be 0%, #300ccc 100%);
    color: #000000;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45);
    background: linear-gradient(135deg, #2DD471 0%, #1B9F3C 100%);
}

.new-chat-btn:active {
    transform: translateY(0);
}

.new-chat-btn .icon {
    font-size: 18px;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.conversations-header {
    padding: 14px 18px 10px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 700;
    letter-spacing: 1px;
}

.conversations-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 10px;
}

.conversation-item {
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    transition: var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item:hover {
    background: rgba(34, 197, 94, 0.08);
    color: var(--text-primary);
    border-color: #22C55E;
}

.conversation-item.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22C55E;
    font-weight: 600;
    border-color: #22C55E;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

body.theme-dark .conversation-item.active {
    background: linear-gradient(135deg, rgba(0, 120, 212, 0.15) 0%, rgba(107, 33, 168, 0.1) 100%);
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.2);
}

.delete-conv-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    transition: var(--transition-fast);
    opacity: 0;
}

.conversation-item:hover .delete-conv-btn {
    opacity: 1;
    color: var(--danger-color);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-secondary);
}

.sidebar-btn {
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-fast);
}

.sidebar-btn:hover {
    background: rgba(34, 197, 94, 0.1);
    color: #22C55E;
    border-color: #22C55E;
}

.sidebar-btn .icon {
    font-size: 16px;
}

body.theme-dark .sidebar-btn:hover {
    background: rgba(0, 120, 212, 0.15);
    color: var(--primary-color);
    border-color: var(--primary-color);
}
/*=======SIDEBAR ENDS HERE======*/

/* ===== CHAT AREA ===== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--header-bg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-info {
    flex: 1;
}

.chat-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    background: linear-gradient(135deg, #22C55E 0%, #34D399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.theme-dark .chat-header h1 {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.conversation-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.conversation-name::before {
    content: "💬";
    font-size: 14px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/*==========CHAT AREA ENDS HERE=========*/

/* Welcome Message */
.welcome-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.welcome-content {
    text-align: center;
    max-width: 700px;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

body.theme-dark .welcome-content {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.welcome-content h2 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #22C55E 0%, #34D399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

body.theme-dark .welcome-content h2 {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prompt-btn {
    padding: 14px 20px;
    border: 1px solid #22C55E;
    border-radius: var(--radius-lg);
    background: rgba(34, 197, 94, 0.08);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.prompt-btn:hover {
    background: rgba(34, 197, 94, 0.15);
    color: #22C55E;
    border-color: #22C55E;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

body.theme-dark .prompt-btn {
    border-color: var(--primary-color);
    background: rgba(0, 120, 212, 0.08);
    color: var(--text-primary);
}

body.theme-dark .prompt-btn:hover {
    background: rgba(0, 120, 212, 0.15);
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.2);
}

/*=========WELCOME MESSAGE ENDS HERE=========*/

/* Messages */
.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease-in-out;
    margin-bottom: 8px;
}

.message.ai {
    justify-content: flex-start;
}

.message.ai .message-bubble {
    position: relative;
}

.message.ai .message-bubble::before {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background: inherit;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    left: -14px;
    top: 12px;
    opacity: 0.5;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-timestamp {
    font-size: 11px;
    color: var(--text-tertiary);
    opacity: 0.7;
}

.message.user .message-timestamp {
    text-align: right;
}

.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: var(--transition);
}

.message-action-btn:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: messageBounce 0.3s ease-out;
    position: relative;
    display: inline-block;
}

.message-bubble:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

@keyframes messageBounce {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #0078D4 0%, #1084D6 100%);
    color: white;
    border-radius: 20px 8px 20px 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.25);
}

.message.user .message-bubble:hover {
    box-shadow: 0 6px 16px rgba(0, 120, 212, 0.35);
    background: linear-gradient(135deg, #0081E0 0%, #1090DF 100%);
}

body.theme-dark .message.user .message-bubble {
    background: linear-gradient(135deg, #0078D4 0%, #1084D6 100%);
    border-color: rgba(0, 120, 212, 0.4);
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.35);
}

body.theme-dark .message.user .message-bubble:hover {
    box-shadow: 0 6px 16px rgba(0, 120, 212, 0.45);
}

.message.ai .message-bubble {
    background: var(--ai-msg-bg);
    color: var(--text-primary);
    border-radius: 8px 20px 20px 20px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.ai .message-bubble:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.theme-dark .message.ai .message-bubble {
    background: linear-gradient(135deg, #2D2D30 0%, #3D3D42 100%);
    border-color: var(--border-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.theme-dark .message.ai .message-bubble:hover {
    background: linear-gradient(135deg, #3A3A40 0%, #4A4A50 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/*========MESSAGES ENDS HERE========*/

/* Message Content Styling */
.message-content {
    word-break: break-word;
    white-space: pre-wrap;
}

.message-bubble strong {
    font-weight: 700;
}

.message.user .message-bubble strong {
    color: #FFFFFF;
    font-weight: 700;
}

.message.ai .message-bubble strong {
    color: var(--primary-color);
    font-weight: 700;
}

.message-bubble em {
    font-style: italic;
}

.message.user .message-bubble em {
    color: rgba(255, 255, 255, 0.9);
}

.message.ai .message-bubble em {
    color: var(--text-secondary);
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 12px;
    display: inline-block;
}

.message.user .message-bubble code {
    background: rgba(0, 0, 0, 0.2);
    color: #FFFFFF;
}

.message.ai .message-bubble code {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.theme-dark .message.ai .message-bubble code {
    background: rgba(0, 0, 0, 0.4);
    color: #E0E0E0;
}

.message-image {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-image img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/*========== Message Content Styling =========*/

/* Input Area */
.input-area {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 200px;
    transition: var(--transition);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

body.theme-dark .message-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.input-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

/*========= INPUT AREA ENDS HERE ==========*/

/* ===== MODALS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.modal-overlay.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal.active {
    display: block;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/*======== MODALS ENDS HERE =======*/

/* Settings Sections */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.theme-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.radio-option:hover {
    background: var(--bg-secondary);
}

.radio-option input[type="radio"] {
    cursor: pointer;
    accent-color: var(--primary-color);
}

.radio-label {
    font-size: 14px;
    color: var(--text-primary);
}

.about-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.features-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.features-list li {
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.features-list li:last-child {
    border-bottom: none;
}

/* SETTINGS OPTION ENDS HERE */

/* Knowledge Management Styles */
.knowledge-section {
    margin-bottom: 24px;
}

.knowledge-section h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.knowledge-list {
    max-height: 400px;
    overflow-y: auto;
}

.knowledge-entries {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.knowledge-entry {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: var(--bg-secondary);
    transition: var(--transition);
}

.knowledge-entry:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.knowledge-key {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
    word-break: break-word;
}

.knowledge-value {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    word-break: break-word;
    max-height: 80px;
    overflow: hidden;
}

.knowledge-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #D81B1B;
    opacity: 0.9;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.spinner {
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        height: 0;
        overflow: hidden;
        transition: var(--transition);
    }

    .app-container.menu-open .sidebar {
        height: 100%;
    }

    .message-bubble {
        max-width: 85%;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }

    .chat-header h1 {
        font-size: 18px;
    }

    .messages-container {
        padding: 16px;
    }

    .input-area {
        padding: 12px 16px 16px;
    }
}
/* ===== BOOKERA INTEGRATION STYLES ===== */

/* Learning Path Cards */
.learning-path {
    margin: 12px 0;
    padding: 16px;
    border-left: 4px solid var(--primary-color);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    transition: var(--transition);
}

.learning-path:hover {
    box-shadow: var(--shadow-sm);
}

.learning-path-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.learning-steps {
    list-style: none;
    counter-reset: step-counter;
}

.learning-step {
    counter-increment: step-counter;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border-radius: calc(var(--radius) / 2);
    border-left: 3px solid var(--primary-color);
    transition: var(--transition);
}

.learning-step:hover {
    transform: translateX(4px);
}

.learning-step::before {
    content: "Step " counter(step-counter);
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
}

.step-type {
    font-weight: 600;
    color: var(--primary-color);
    display: inline-block;
    margin-left: 8px;
}

.step-description {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Bookera Resources Display */
.bookera-resources {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
}

.bookera-header {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bookera-header::before {
    content: "📚";
    font-size: 18px;
}

.resource-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.resource-item {
    padding: 10px;
    margin-bottom: 6px;
    background: var(--bg-primary);
    border-left: 3px solid var(--secondary-color);
    border-radius: calc(var(--radius) / 2);
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.resource-item:hover {
    background: var(--primary-light);
    border-left-color: var(--primary-color);
    color: var(--text-primary);
}

body.theme-dark .resource-item:hover {
    background: rgba(0, 120, 212, 0.1);
}

.resource-type {
    display: inline-block;
    padding: 2px 6px;
    background: var(--secondary-color);
    color: white;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 6px;
    font-weight: 600;
}

.resource-type.exam {
    background: var(--primary-color);
}

.resource-type.book {
    background: var(--secondary-color);
}

/* Exam Papers Display */
.exam-papers {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
}

.exam-papers-header {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exam-papers-header::before {
    content: "📝";
    font-size: 18px;
}

.exam-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exam-item {
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: calc(var(--radius) / 2);
    cursor: pointer;
    transition: var(--transition);
}

.exam-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
    transform: translateY(-2px);
}

body.theme-dark .exam-item:hover {
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.exam-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.exam-difficulty {
    display: inline-block;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.exam-difficulty.beginner {
    background: #90EE90;
    color: #000;
}

.exam-difficulty.intermediate {
    background: #FFD700;
    color: #000;
}

.exam-difficulty.advanced {
    background: #FF6B6B;
    color: #fff;
}

.exam-usage-guide {
    background: var(--primary-light);
    border-left: 4px solid var(--primary-color);
    padding: 12px;
    margin-top: 12px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
}

body.theme-dark .exam-usage-guide {
    background: rgba(0, 120, 212, 0.1);
    border-left-color: var(--primary-color);
}

.usage-list {
    list-style-position: inside;
    margin: 8px 0;
    padding: 0;
}

.usage-list li {
    margin-bottom: 4px;
}

/* Knowledge Stats */
.knowledge-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.stat-card {
    background: var(--primary-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    transition: var(--transition);
}

body.theme-dark .stat-card {
    background: rgba(0, 120, 212, 0.1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Topic Badges */
.topic-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.topic-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--primary-color);
    transition: var(--transition);
}

body.theme-dark .topic-badge {
    background: rgba(0, 120, 212, 0.1);
}

.topic-badge:hover {
    background: var(--primary-color);
    color: white;
}

body.theme-dark .topic-badge:hover {
    background: var(--primary-color);
    color: white;
}

/* Code Blocks in Messages */
.message-code {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--primary-color);
    padding: 12px;
    margin: 8px 0;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

.code-language {
    display: inline-block;
    padding: 2px 6px;
    background: var(--primary-color);
    color: white;
    border-radius: 3px;
    font-size: 11px;
    margin-bottom: 6px;
    font-weight: 600;
}

/* Info Box */
.info-box {
    background: var(--primary-light);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius);
    padding: 12px;
    margin: 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

body.theme-dark .info-box {
    background: rgba(0, 120, 212, 0.1);
    border-color: var(--primary-color);
}

.info-box::before {
    content: "ℹ️ ";
    margin-right: 6px;
    font-weight: 700;
}

/* Success Message */
.success-box {
    background: #E8F5E9;
    border-left: 4px solid #4CAF50;
    padding: 12px;
    margin: 12px 0;
    border-radius: var(--radius);
    color: #2E7D32;
    font-size: 13px;
}

body.theme-dark .success-box {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4CAF50;
    color: #81C784;
}

/* Warning Box */
.warning-box {
    background: #FFF3E0;
    border-left: 4px solid #FF9800;
    padding: 12px;
    margin: 12px 0;
    border-radius: var(--radius);
    color: #E65100;
    font-size: 13px;
}

body.theme-dark .warning-box {
    background: rgba(255, 152, 0, 0.1);
    border-left-color: #FF9800;
    color: #FFB74D;
}

/* Error Box */
.error-box {
    background: #FFEBEE;
    border-left: 4px solid var(--danger-color);
    padding: 12px;
    margin: 12px 0;
    border-radius: var(--radius);
    color: #B71C1C;
    font-size: 13px;
}

body.theme-dark .error-box {
    background: rgba(232, 17, 35, 0.1);
    border-left-color: var(--danger-color);
    color: #EF9A9A;
}

/* Enhanced Button Styles */
.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: calc(var(--radius) / 2);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-light);
}

body.theme-dark .btn-outline:hover {
    background: rgba(0, 120, 212, 0.1);
}

/* Table Styling */
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.styled-table th {
    background: var(--primary-color);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 600;
}

.styled-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-light);
}

.styled-table tr:hover {
    background: var(--bg-primary);
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 16px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: loading-pulse 1.4s infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loading-pulse {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Enhanced Message Formatting */
.message-bold {
    font-weight: 700;
}

.message-italic {
    font-style: italic;
}

.message-strikethrough {
    text-decoration: line-through;
}

.message-highlight {
    background: var(--primary-light);
    padding: 2px 4px;
    border-radius: 2px;
}

body.theme-dark .message-highlight {
    background: rgba(0, 120, 212, 0.2);
}

/* List Enhancements */
.styled-list {
    list-style: none;
    padding: 0;
}

.styled-list li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-secondary);
    font-size: 13px;
}

.styled-list li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* Anchor/Link Enhancements */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Mobile Responsive Updates */
@media (max-width: 480px) {
    .knowledge-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .learning-path {
        padding: 12px;
    }

    .bookera-resources {
        padding: 12px;
    }

    .exam-papers {
        padding: 12px;
    }

    .styled-table {
        font-size: 12px;
    }

    .styled-table th,
    .styled-table td {
        padding: 8px;
    }
}
{