/* Reset and Base Styles */
:root {
    --chat-primary-color: #4F46E5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh; 
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

/* Header */
.header {
    background: #000000;
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.header h1 i {
    margin-right: 0.5rem;
    color: #ffd700;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4444;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: #44ff44;
}

.status-dot.offline {
    background: #ff4444;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Navigation */
.nav-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0 2rem;
}

/* Navigation Enhancements */
.nav-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.nav-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.nav-tab:hover::before {
    left: 100%;
}

.nav-tab:hover {
    background: #e9ecef;
    color: #495057;
    transform: translateY(-2px);
}

.nav-tab.active {
    color: #000000;
    border-bottom-color: #000000;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 140px);
    background: #f8f9fa;
}

.tab-content {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Page Container */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Training Section */
.training-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.upload-area {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.upload-box {
    border: 3px dashed #000000;
    border-radius: 10px;
    padding: 3rem;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: #333333;
    background: #e9ecef;
    transform: translateY(-2px);
}

.upload-box i {
    font-size: 3rem;
    color: #000000;
    margin-bottom: 1rem;
}

.upload-box h3 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.upload-box p {
    color: #6c757d;
    font-size: 1rem;
}

.text-input-section {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.text-input-section h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.3rem;
}

#text-input {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1rem;
    font-family: inherit;
}

#text-input:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Enhanced Button Styles */
.btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 200ms ease, background-color 180ms ease, color 180ms ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-4px) scale(1.02);
    background: #000000;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled::before {
    display: none;
}

.btn-secondary {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
}
.btn-secondary:hover {
    transform: translateY(-4px) scale(1.02);
    background: #ffffff;
    color: #000000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

/* Primary button variant */
.btn.primary, .btn-primary {
    transition: transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 200ms ease, background-color 180ms ease, color 180ms ease;
}
.btn.primary:hover, .btn-primary:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 14px 40px rgba(79,70,229,0.12);
}

/* Ghost button subtle hover */
.btn.ghost, .btn-ghost {
    transition: transform 160ms cubic-bezier(.2,.9,.2,1), box-shadow 160ms ease, background-color 160ms ease;
}
.btn.ghost:hover, .btn-ghost:hover {
    transform: translateY(-3px);
    background: rgba(15,23,36,0.04);
    box-shadow: 0 8px 22px rgba(2,6,23,0.06);
}

/* Processing Status */
.processing-status {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.progress-container {
    max-width: 400px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #000000, #333333);
    width: 0%;
    transition: width 0.3s ease;
}

/* Removed infinite progress animation - now controlled by JavaScript */

/* Training History */
.training-history {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.training-history h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.3s ease;
}

.history-item:hover {
    background: #e9ecef;
}

.history-item:last-child {
    border-bottom: none;
}

/* Chat Section */
.chat-page-content {
    display: flex;
    justify-content: center;
}

.chat-container {
    width: 100%;
    max-width: 900px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;

/* Ensure dashboard top nav matches landing header styles */
.nav{position:fixed;left:0;right:0;top:0;backdrop-filter:blur(6px);z-index:40;background:transparent}
.nav-inner{max-width:1100px;margin:0 auto;padding:18px 8px;display:flex;align-items:center;justify-content:space-between}
.brand{font-weight:700;color:#0f1724;font-size:20px;letter-spacing:-0.02em;font-family:Poppins, Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial}
.brand .dot{color:#6b46ff;margin-left:6px}
.nav-links a{color:#667085;margin-left:18px;text-decoration:none;font-weight:600;transition:transform 160ms cubic-bezier(.2,.9,.2,1),color 160ms ease}
.nav-links a:hover{transform:translateY(-3px);color:#25303a}
.nav-links a.cta{background:linear-gradient(90deg,#4f46e5,#6b46ff);color:#fff;padding:10px 14px;border-radius:10px;box-shadow:0 6px 18px rgba(99,102,241,0.12);transition:transform 160ms cubic-bezier(.2,.9,.2,1),box-shadow 180ms ease}
.nav-links a.cta:hover{transform:translateY(-4px) scale(1.02);box-shadow:0 12px 30px rgba(99,102,241,0.16)}

/* Ensure brand/logo sits at the left and the nav (links + login) sits at the right */
.brand{margin-right:auto;display:flex;align-items:center;margin-left:-8px}

/* New brand logo sizing: use your provided Kaynai image at this path */
.brand-text{font-weight:700;color:#063046;font-size:28px !important;letter-spacing:-0.02em;font-family:Poppins, Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial}
.brand-accent{color:#20c7ff !important;margin-left:6px}
.brand > .brand-link{cursor:pointer;text-decoration:none;color:inherit}
.brand-link:focus{outline: none}
/* Subtle hover effect: slight lift + scale + accent brighten */
.brand-link{display:inline-block;transition:transform 160ms cubic-bezier(.2,.9,.2,1),color 160ms ease}
.brand-link .brand-text{display:inline-block;transition:transform 160ms cubic-bezier(.2,.9,.2,1),color 160ms ease}
.brand-link .brand-accent{transition:color 160ms ease, filter 160ms ease}
.brand-link:hover .brand-text{transform:translateY(-3px) scale(1.04)}
.brand-link:hover .brand-accent{filter:brightness(1.06)}
.brand-link:active .brand-text{transform:translateY(0) scale(0.995)}
.brand-link:focus{box-shadow:0 6px 20px rgba(32,199,255,0.12);border-radius:6px}
/* Backup: make hover stronger on non-landing pages too */
.brand-link:hover .brand-text{transform:translateY(-6px) scale(1.08) !important; text-shadow:0 6px 18px rgba(2,132,199,0.08) !important}
.brand-link:hover .brand-accent{color:#00c6ff !important; filter:drop-shadow(0 4px 10px rgba(0,198,255,0.10)) !important}
.brand-link .brand-text{position:relative}
.brand-link .brand-text::after{content:'';position:absolute;left:0;right:auto;bottom:-6px;height:3px;width:0;background:linear-gradient(90deg,#20c7ff,#00c6ff);border-radius:3px;transition:width 240ms cubic-bezier(.2,.9,.2,1),opacity 180ms ease;opacity:0}
.brand-link:hover .brand-text::after{width:100%;opacity:1}
.brand-link:focus .brand-text::after{width:100%;opacity:1}
.brand-link:hover, .brand:hover > .brand-link { background: rgba(0,198,255,0.06) !important; padding: 2px 6px !important; border-radius:6px !important; transform: translateY(-4px) !important }
.nav-links{margin-left:auto;display:flex;align-items:center;gap:18px}
.nav-links a{margin-left:0}

/* If header uses .header-content, keep actions on the right */
.header-content{display:flex;justify-content:space-between;align-items:center}
.header-content .header-actions{margin-left:auto}

/* Make header-actions align with nav when present */
.header-actions{display:flex;align-items:center;gap:12px}
.status-text{color:#fff}
.status-dot{width:10px;height:10px;border-radius:50%;background:#ff4444}

/* Remove boxed container look so app appears on the landing gradient */
#main-container.container, #main-container {
    background: transparent !important;
    box-shadow: none !important;
    min-height: auto;
    padding-top: 0 !important;
}

/* Make the tab row blend with the landing header */
.nav-tabs {
    background: transparent;
    border-bottom: none;
    padding: 0 2rem;
    margin-top: 8px;
}

.nav-tab.active {
    background: rgba(255,255,255,0.9);
    box-shadow: 0 6px 18px rgba(2,6,23,0.06);
    border-bottom-color: transparent;
}

.main-content {
    background: transparent;
}
    height: 70vh;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: #f8f9fa;
}

.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.user-message .message-avatar {
    background: #667eea;
    color: white;
}

.bot-message .message-avatar {
    background: var(--chat-primary-color, #28a745);
    color: white;
}

.message-content {
    background: white;
    padding: 1.2rem;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 70%;
    line-height: 1.5;
}

.user-message .message-content {
    background: #667eea;
    color: white;
    margin-left: auto;
}

.bot-message .message-content {
    background: rgba(79, 70, 229, 0.08);
    border-left: 3px solid var(--chat-primary-color, #4F46E5);
}

.context-snippets {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 3px solid #667eea;
}

.chat-input-container {
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e9ecef;
}

.chat-input-wrapper {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
}

#chat-input:focus {
    outline: none;
    border-color: #000000;
}

.chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.response-settings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Analytics Section */
.analytics-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.metrics-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.metric-content h3 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.metric-content p {
    color: #6c757d;
    font-size: 0.9rem;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-container {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container canvas {
    max-height: 300px;
}

.activity-section {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.activity-section h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #000000;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Bot Tuning Section */
.tuning-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.tuning-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.response-review {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.response-review h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.review-list {
    max-height: 500px;
    overflow-y: auto;
}

.review-item {
    padding: 1.2rem;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.review-item:hover {
    border-color: #000000;
    background: #f0f0f0;
    transform: translateY(-2px);
}

.review-item.selected {
    border-color: #000000;
    background: #e0e0e0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.feedback-form {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.feedback-form h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-item {
    margin-bottom: 1.5rem;
}

.feedback-item h4 {
    margin-bottom: 0.5rem;
    color: #333;
}

.feedback-input {
    margin-bottom: 1rem;
}

.rating-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.rating-btn {
    background: white;
    border: 2px solid #dee2e6;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #495057;
}

.rating-btn:hover {
    border-color: #4F46E5;
    background: #f8f9ff;
    color: #4F46E5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.rating-btn.selected {
    border-color: #4F46E5;
    background: #4F46E5;
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.feedback-text textarea,
.suggested-response textarea {
    width: 100%;
    height: 100px;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    margin-top: 0.5rem;
}

.feedback-text textarea:focus,
.suggested-response textarea:focus {
    outline: none;
    border-color: #000000;
}

.tuning-settings {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tuning-settings h3 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
}

.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

.setting-group input[type="range"] {
    padding: 0;
}

.setting-group span {
    margin-left: 1rem;
    color: #667eea;
    font-weight: 500;
}

/* Knowledge Base History Items */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #000000;
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.item-info {
    flex: 1;
}

.item-info strong {
    display: block;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.item-info small {
    color: #6c757d;
    line-height: 1.4;
}

.item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.item-timestamp {
    color: #6c757d;
    font-size: 0.85rem;
}

.item-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Small Button Variant */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Danger Button Variant */
.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

/* Knowledge Base Header */
.knowledge-base-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.knowledge-base-header h3 {
    margin: 0;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #000000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .nav-tabs {
        padding: 0 1rem;
        overflow-x: auto;
    }
    
    .nav-tab {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .page-container {
        padding: 1rem;
    }
    
    .upload-section {
        grid-template-columns: 1fr;
    }
    
    .upload-box {
        padding: 2rem 1rem;
    }
    
    .chat-container {
        height: 60vh;
        margin: 0;
        border-radius: 0;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .metrics-overview {
        grid-template-columns: 1fr;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .tuning-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .chat-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rating-buttons {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .nav-tabs {
        flex-direction: column;
    }
    
    .nav-tab {
        justify-content: center;
    }
    
    .upload-box i {
        font-size: 2rem;
    }
    
    .upload-box h3 {
        font-size: 1.2rem;
    }
    
    .metric-card {
        flex-direction: column;
        text-align: center;
    }
    
    .message {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-message {
        align-items: flex-end;
    }
    
    .message-avatar {
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    .message-content {
        max-width: 100%;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f8f9fa;
    color: #495057;
}

.modal-body {
    padding: 1.5rem;
}

.document-info {
    margin-bottom: 2rem;
}

.info-row {
    display: flex;
    margin-bottom: 0.75rem;
}

.info-label {
    font-weight: 600;
    min-width: 120px;
    color: #495057;
}

.info-value {
    color: #6c757d;
}

.document-content h4 {
    margin-bottom: 1rem;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.content-preview {
    max-height: 400px;
    overflow-y: auto;
}

.content-controls {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.content-controls .btn {
    font-size: 0.85rem;
    padding: 0.375rem 0.75rem;
}

.content-controls .btn.active {
    background-color: #000000;
    border-color: #000000;
    color: white;
}

.content-text {
    max-height: 400px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.content-text.full-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
    margin: 0;
    max-height: 600px;
    overflow-y: auto;
}

.chunk-preview {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #000000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chunk-header {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.chunk-text {
    color: #6c757d;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.item-preview {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
    font-style: italic;
    line-height: 1.3;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}
/* ================== INTEGRATE TAB STYLES ================== */

.integrate-content {
    max-width: 1200px;
    margin: 0 auto;
}

.integrate-header {
    text-align: center;
    margin-bottom: 3rem;
}

.integrate-header h2 {
    font-size: 2rem;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.integrate-header p {
    color: #718096;
    font-size: 1.1rem;
}

.integration-methods {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
}

.integration-method {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.integration-method:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: #4F46E5;
}

.method-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.method-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.method-icon i {
    font-size: 28px;
    color: white;
}

.method-header h3 {
    font-size: 1.5rem;
    color: #1a202c;
    margin: 0 0 0.5rem 0;
}

.method-description {
    color: #718096;
    margin: 0;
}

.method-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4a5568;
    font-size: 0.95rem;
}

.feature i {
    color: #48bb78;
    font-size: 1.1rem;
}

.code-section {
    margin: 1.5rem 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.code-header h4 {
    margin: 0;
    color: #1a202c;
}

.code-block {
    background: #1a202c;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

.code-block code {
    color: #e2e8f0;
}

.code-block span {
    color: #fbbf24;
}

.config-options {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.config-options h4 {
    margin: 0 0 1rem 0;
    color: #1a202c;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.config-item {
    display: flex;
    flex-direction: column;
}

.config-item label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-size: 0.9rem;
}

.config-input {
    padding: 0.625rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.config-input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.integration-test {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 2rem;
}

.integration-test h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.integration-test p {
    margin: 0 0 1.5rem 0;
    opacity: 0.95;
}

.integration-test .btn {
    background: white;
    color: #667eea;
    font-weight: 600;
}

.integration-test .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.integration-docs {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.integration-docs h3 {
    margin: 0 0 1.5rem 0;
    color: #1a202c;
    font-size: 1.5rem;
}

.docs-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.doc-section h4 {
    color: #2d3748;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.doc-section p {
    color: #718096;
    margin: 0;
    line-height: 1.6;
}

.doc-section .code-block {
    margin-top: 0.75rem;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #4338CA;
    transform: translateY(-1px);
}

.copy-btn i {
    font-size: 0.9rem;
}

/* Floating Customize Button */
.floating-customize-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #6B46FF 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 999;
}

.floating-customize-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
}

/* Customization Modal */
.customize-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.customize-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.customize-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customize-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.customize-modal-body {
    padding: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .method-header {
        flex-direction: column;
    }
    
    .method-features {
        grid-template-columns: 1fr;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* ================== END INTEGRATE TAB STYLES ================== */
/* ================== WEB SCRAPER TAB STYLES ================== */

.scraper-content {
    padding: 2rem;
}

.scraper-header h2 {
    font-size: 2rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.scraper-input-section input[type="url"] {
    outline: none;
    transition: border-color 0.2s ease;
}

.scraper-input-section input[type="url"]:focus {
    border-color: #20c7ff;
    box-shadow: 0 0 0 3px rgba(32, 199, 255, 0.1);
}

#scraper-status {
    animation: slideIn 0.3s ease;
}

#scraper-preview {
    animation: slideIn 0.4s ease;
}

#content-display {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#content-editor {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

#content-editor:focus {
    border-color: #20c7ff;
    box-shadow: 0 0 0 3px rgba(32, 199, 255, 0.1);
}

.scraper-help ul li {
    margin-bottom: 0.5rem;
}

#scrape-btn {
    transition: all 0.2s ease;
}

#scrape-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(32, 199, 255, 0.3);
}

#scrape-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#edit-actions {
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .scraper-content {
        padding: 1rem;
    }
    
    .scraper-header h2 {
        font-size: 1.5rem;
    }
    
    .scraper-input-section {
        padding: 1.5rem !important;
    }
    
    .scraper-input-section > div:first-of-type {
        flex-direction: column;
    }
    
    #scrape-btn {
        width: 100%;
    }
}

/* ================== END WEB SCRAPER TAB STYLES ================== */

/* ================== SETTINGS TAB STYLES ==================  */

.settings-content {
    max-width: 900px;
    margin: 0 auto;
}

.settings-header {
    margin-bottom: 32px;
}

.settings-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #063046;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-header h2 i {
    color: #20c7ff;
}

.settings-header p {
    color: #666;
    font-size: 15px;
}

.settings-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.settings-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #063046;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-card h3 i {
    color: #20c7ff;
    font-size: 18px;
}

.card-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.settings-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #20c7ff;
}

.info-row label {
    font-weight: 600;
    color: #063046;
    min-width: 140px;
    font-size: 14px;
}

.info-value {
    color: #333;
    font-size: 14px;
    word-break: break-word;
}

#reset-password-btn {
    margin-top: 4px;
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
}

.reset-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.reset-message.success {
    display: block;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.reset-message.error {
    display: block;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.reset-message.info {
    display: block;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

@media (max-width: 768px) {
    .settings-card {
        padding: 20px;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .info-row label {
        min-width: unset;
    }
    
    #reset-password-btn {
        max-width: 100%;
    }
}

/* ================== END SETTINGS TAB STYLES ================== */

/* ================== WEB SCRAPER TAB STYLES ================== */

.scraper-content {
    padding: 2rem;
}

.scraper-header h2 {
    font-size: 2rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.scraper-input-section input[type="url"] {
    outline: none;
    transition: border-color 0.2s ease;
}

.scraper-input-section input[type="url"]:focus {
    border-color: #20c7ff;
    box-shadow: 0 0 0 3px rgba(32, 199, 255, 0.1);
}

#scraper-status {
    animation: slideIn 0.3s ease;
}

#scraper-preview {
    animation: slideIn 0.4s ease;
}

#content-display {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#content-editor {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

#content-editor:focus {
    border-color: #20c7ff;
    box-shadow: 0 0 0 3px rgba(32, 199, 255, 0.1);
}

.scraper-help ul li {
    margin-bottom: 0.5rem;
}

#scrape-btn {
    transition: all 0.2s ease;
}

#scrape-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(32, 199, 255, 0.3);
}

#scrape-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#edit-actions {
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .scraper-content {
        padding: 1rem;
    }
    
    .scraper-header h2 {
        font-size: 1.5rem;
    }
    
    .scraper-input-section {
        padding: 1.5rem !important;
    }
    
    .scraper-input-section > div:first-of-type {
        flex-direction: column;
    }
    
    #scrape-btn {
        width: 100%;
    }
}

/* ================== END WEB SCRAPER TAB STYLES ================== */

/* ================== MARKDOWN CONTENT STYLES ================== */
.markdown-content {
    line-height: 1.6;
}

.markdown-content p {
    margin-bottom: 0.8em;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content strong,
.markdown-content b {
    font-weight: 600;
    color: #2c3e50;
}

.markdown-content em,
.markdown-content i {
    font-style: italic;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-weight: 600;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    color: #2c3e50;
}

.markdown-content h1 {
    font-size: 1.4em;
}

.markdown-content h2 {
    font-size: 1.3em;
}

.markdown-content h3 {
    font-size: 1.2em;
}

.markdown-content h4 {
    font-size: 1.1em;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.8em 0;
    padding-left: 1.5em;
}

.markdown-content li {
    margin-bottom: 0.4em;
}

.markdown-content ul li {
    list-style-type: disc;
}

.markdown-content ol li {
    list-style-type: decimal;
}

.markdown-content code {
    background: #f4f4f4;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: #f4f4f4;
    padding: 0.8em;
    border-radius: 5px;
    overflow-x: auto;
    margin: 0.8em 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 1em;
    margin: 0.8em 0;
    color: #666;
    font-style: italic;
}

.markdown-content hr {
    border: none;
    border-top: 2px solid #e9ecef;
    margin: 1.2em 0;
}

.markdown-content a {
    color: #4F46E5;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

/* User messages shouldn't have markdown styling */
.user-message .markdown-content p {
    margin-bottom: 0;
}

/* ================== END MARKDOWN CONTENT STYLES ================== */
