:root {
    --background-primary: #0D1B2A;
    --background-secondary: #1B263B;
    --background-tertiary: #2a3a52;
    --stroke-primary: #415A77;
    --text-primary: #F0F4F8;
    --text-secondary: #A9B4C2;
    --accent-primary: #00F5D4;
    --accent-secondary: #9B5DE5;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --font-family-sans: 'Inter', sans-serif;
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family-sans);
    background: var(--background-primary);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: var(--background-primary);
    border-right: 1px solid var(--stroke-primary);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0 .5rem;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.sidebar-header .logo-icon {
    color: var(--accent-primary);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: .5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all .2s ease;
    font-weight: 500;
    font-size: .875rem;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary);
    color: var(--background-primary);
    font-weight: 600;
}

.nav-item svg {
    margin-right: 1rem;
}

.main-content {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #08121E;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn .5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-header {
    padding: 2rem 2.5rem;
    border-bottom: 1px solid var(--stroke-primary);
    background: var(--background-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-secondary);
    margin-top: .25rem;
    font-size: .875rem;
}

.page-content {
    padding: 2.5rem;
}

.card {
    background: var(--background-secondary);
    border-radius: 16px;
    padding: 2.5rem;
    border: 1px solid var(--stroke-primary);
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: .5rem;
}

.card-header p {
    color: var(--text-secondary);
    font-size: .875rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: var(--background-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--stroke-primary);
}

.metric-card-header h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.metric-card-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin: 1.5rem 0;
}

.metric-card-footer {
    font-size: .875rem;
    color: var(--text-secondary);
}

.user-info {
    margin-top: auto;
    padding: 1rem;
    background: var(--background-secondary);
    border-top: 1px solid var(--stroke-primary);
    font-size: .875rem;
}

.user-info p {
    margin-bottom: .5rem;
}

.user-info a {
    color: var(--accent-primary);
    text-decoration: none;
    cursor: pointer;
}

/* Chat Page Styles */
.chat-page-content {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 125px);
    padding: 0;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--background-primary);
}

.chat-history {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--background-primary);
    min-height: 0;
}

.chat-message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--background-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
}

.message-content {
    background: var(--background-tertiary);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    line-height: 1.6;
    font-size: .875rem;
    white-space: pre-wrap;
}

.chat-message.user .message-content {
    background: var(--accent-secondary);
    color: var(--text-primary);
}

.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--stroke-primary);
    background: var(--background-primary);
}

.chat-input-wrapper {
    display: flex;
    gap: 1rem;
    background: var(--background-secondary);
    border-radius: 8px;
    padding: .5rem;
    border: 1px solid var(--stroke-primary);
}

#chat-input {
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--text-primary);
    font-size: 1rem;
    padding: .5rem;
}

#chat-input:focus {
    outline: 0;
}

#chat-send-btn {
    background: var(--accent-primary);
    border: 0;
    border-radius: 6px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Intelligence Panel */
.intelligence-panel {
    width: 350px;
    background: var(--background-secondary);
    border-left: 1px solid var(--stroke-primary);
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
    height: 100%;
}

.panel-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #2a3142;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    color: #8892b0;
    font-size: 12px;
    margin-bottom: 5px;
    font-weight: 500;
}

.control-group select,
.control-group input[type="range"] {
    width: 100%;
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 4px;
    color: #ccd6f6;
    padding: 8px;
    font-size: 13px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

input[type="range"] {
    height: 6px;
    background: #2a3142;
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.vector-stats {
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 8px;
    background: #0f1419;
    border-radius: 4px;
}

.stat-label {
    color: #8892b0;
    font-size: 12px;
}

.stat-item span:last-child {
    color: #00d4ff;
    font-weight: 600;
}

.thinking-display,
.context-display {
    background: #0f1419;
    border: 1px solid #2a3142;
    border-radius: 4px;
    padding: 12px;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.4;
}

.placeholder-text {
    color: #5c6370;
    font-style: italic;
    margin: 0;
}

.thinking-step {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(0, 212, 255, 0.05);
    border-left: 2px solid #00d4ff;
    border-radius: 0 4px 4px 0;
}

.context-chunk {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(100, 255, 218, 0.05);
    border-left: 2px solid #64ffda;
    border-radius: 0 4px 4px 0;
}

.similarity-score {
    color: #64ffda;
    font-weight: 600;
    font-size: 11px;
}

.chunk-text {
    color: #ccd6f6;
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.3;
}

/* Upload and File Styles */
.upload-area {
    border: 2px dashed var(--stroke-primary);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    margin-top: 2rem;
    transition: background-color .2s ease;
    cursor: pointer;
}

.upload-area.dragover {
    background-color: var(--background-tertiary);
}

.upload-area p {
    margin: 1rem 0;
    color: var(--text-secondary);
}

#file-upload-input {
    display: none;
}

.file-table {
    width: 100%;
    margin-top: 2rem;
    border-collapse: collapse;
}

.file-table th,
.file-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--stroke-primary);
    font-size: .875rem;
}

.file-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.status-badge {
    padding: .25rem .75rem;
    border-radius: 1rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.completed,
.status-badge.completed-empty {
    background-color: var(--success);
    color: var(--background-primary);
}

.status-badge.processing,
.status-badge.queued {
    background-color: var(--warning);
    color: var(--background-primary);
}

.status-badge.error {
    background-color: var(--error);
    color: var(--text-primary);
}

/* Education Page Styles */
.learning-content {
    line-height: 1.7;
    color: var(--text-secondary);
}

.learning-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin: 2rem 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--stroke-primary);
}

.learning-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.diagram-container {
    background: var(--text-primary);
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Campaign Page Styles */
#campaign-brief {
    width: 100%;
    height: 150px;
    background: var(--background-secondary);
    border: 1px solid var(--stroke-primary);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    margin-top: 1.5rem;
    resize: vertical;
}

.btn {
    background: var(--accent-primary);
    color: var(--background-primary);
    border: 0;
    padding: .8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: .875rem;
}

.plan-card {
    background: var(--background-tertiary);
    padding: 1.5rem;
    border-radius: 12px;
}

.plan-card h3 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.plan-card ul {
    list-style-position: inside;
    padding-left: 1rem;
}

/* Login Page Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background-primary);
}

.login-card {
    background: var(--background-secondary);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--stroke-primary);
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: .875rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: .5rem;
    font-weight: 500;
    font-size: .875rem;
}

.form-group input {
    width: 100%;
    padding: .75rem 1rem;
    border: 1px solid var(--stroke-primary);
    border-radius: 8px;
    background: var(--background-primary);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: 0;
    border-color: var(--accent-primary);
}

.login-btn {
    width: 100%;
    background: var(--accent-primary);
    color: var(--background-primary);
    border: 0;
    padding: .875rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.auth-toggle {
    text-align: center;
    color: var(--text-secondary);
    font-size: .875rem;
}

.auth-toggle a {
    color: var(--accent-primary);
    text-decoration: none;
    cursor: pointer;
}

.error-message {
    color: var(--error);
    font-size: .875rem;
    margin-top: .5rem;
    text-align: center;
}