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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #8e9aaf 0%, #6c757d 100%);
    min-height: 100vh;
    padding: 20px;
}

.main-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 350px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.toc-description {
    margin: 8px 0 0 0;
    font-size: 0.85em;
    opacity: 0.9;
    font-weight: normal;
}

.toc-content {
    flex: 1;
    padding: 20px;
}

.toc-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.toc-item:hover {
    background: #e9ecef;
    border-left-color: #6c757d;
    transform: translateX(5px);
}

.chapter-num {
    background: #6c757d;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.suggested-questions {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.suggested-questions h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1em;
}

.question-btn {
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.question-btn:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
}

/* Chat Container Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.chat-header h2 {
    margin-bottom: 8px;
    font-size: 1.5em;
}

.chat-header p {
    margin-bottom: 4px;
    font-size: 0.95em;
    line-height: 1.3;
}

.subtitle {
    opacity: 0.8;
    font-size: 0.85em !important;
}

/* Thesis link styling */
.thesis-link {
    color: white;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.thesis-link:hover {
    color: #f8f9fa;
    border-bottom: 1px solid white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Header links container */
.header-links {
    margin-top: 12px;
    display: flex;
    flex-direction: row;
    gap: 16px;
    justify-content: center;
}

/* Individual header link styling */
.github-link, .website-link, .contact-link {
    margin: 0;
    font-size: 14px;
}

.github-link a, .website-link a, .contact-link a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.github-link a:hover, .website-link a:hover, .contact-link a:hover {
    color: white;
    text-decoration: underline;
}

/* GitHub SVG icon styling */
.github-link svg {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.github-link a:hover svg {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    height: 0; /* Forces flex child to respect overflow */
}

.message {
    margin-bottom: 15px;
    display: flex;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: #6c757d;
    color: white;
    margin-left: auto;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.context-control {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.context-control label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

#contextValue {
    color: #6c757d;
    font-weight: 700;
}

#contextSlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    margin-bottom: 5px;
    -webkit-appearance: none;
}

#contextSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6c757d;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#contextSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6c757d;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.context-help {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
    margin-top: 5px;
}

.input-group {
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

#messageInput:focus {
    border-color: #6c757d;
}

#sendButton {
    padding: 12px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

#sendButton:hover {
    background: #0056b3;
}

#sendButton:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.status {
    margin-top: 10px;
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border-color: #f5c6cb !important;
}

/* Responsive Design for Mobile */
@media (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
    }
    
    .main-container {
        flex-direction: column;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    /* Hide sidebar on mobile to prioritize chat */
    .sidebar {
        display: none;
    }
    
    .chat-container {
        width: 100%;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .chat-header {
        padding: 15px;
        flex-shrink: 0;
    }
    
    .chat-header h2 {
        font-size: 1.3em;
    }
    
    .chat-header p {
        font-size: 0.9em;
    }
    
    /* Header links mobile styling */
    .header-links {
        margin-top: 8px;
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .github-link, .website-link, .contact-link {
        font-size: 13px;
    }
    
    .chat-messages {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
        max-height: none;
    }
    
    .message-content {
        max-width: 100%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .chat-input-container {
        padding: 15px;
        flex-shrink: 0;
        background: white;
    }
    
    .context-control {
        margin-bottom: 12px;
        padding: 10px;
    }
    
    .context-control label {
        font-size: 13px;
    }
    
    .context-help {
        font-size: 11px;
    }
    
    #messageInput {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    #sendButton {
        padding: 10px 18px;
        font-size: 14px;
    }
}

/* Tablet size - show sidebar but make it narrower */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .main-container {
        max-width: 100%;
    }
} 