/* RAG System Styles */

body {
    font-family: Arial, sans-serif;
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px;
    background-color: #f5f5f5;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    box-sizing: border-box;
}

/* Main Container - Two Column Layout */
.main-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

.left-panel {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    max-width: 100%;
}

.right-panel {
    width: 320px;
    flex-shrink: 0;
    max-width: 100%;
}

/* Progress Section in Right Panel */
.progress-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    margin-bottom: 15px;
    max-width: 100%;
    box-sizing: border-box;
}

.progress-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
    word-wrap: break-word;
}

/* Progress Container - Now in right panel */
.progress-container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    border: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.progress-bar {
    width: 100%;
    height: 16px;
    background-color: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #0056b3);
    border-radius: 8px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-text {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-top: 4px;
}

.progress-status {
    font-size: 10px;
    color: #888;
    text-align: center;
}

/* Status Section in Right Panel */
.status-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    max-width: 100%;
    box-sizing: border-box;
}

.status-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
    word-wrap: break-word;
}

.status-messages {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #f8f9fa;
    max-width: 100%;
    box-sizing: border-box;
}

.status-item {
    padding: 8px 10px;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.status-item:last-child {
    border-bottom: none;
}

.status-time {
    display: block;
    font-weight: bold;
    color: #666;
    margin-bottom: 2px;
    font-size: 10px;
    word-wrap: break-word;
}

.status-text {
    display: block;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.status-item.success {
    background-color: #d4edda;
    border-left: 3px solid #28a745;
}

.status-item.error {
    background-color: #f8d7da;
    border-left: 3px solid #dc3545;
}

.status-item.info {
    background-color: #d1ecf1;
    border-left: 3px solid #17a2b8;
}

.status-item.warning {
    background-color: #fff3cd;
    border-left: 3px solid #ffc107;
}

/* Collapsible Sections */
.collapsible-section {
    background: white;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    background: #007cba;
    color: white;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.section-header:hover {
    background: #005a87;
}

.section-header h2 {
    margin: 0;
    font-size: 16px;
}

.collapse-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.section-content {
    padding: 20px;
    display: block;
    transition: all 0.3s ease;
}

.section-content.collapsed {
    display: none;
}

.section-header.collapsed .collapse-icon {
    transform: rotate(180deg);
}

/* Container */
.container {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
    overflow-x: hidden;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
}

.input-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fafafa;
}

.input-type-selector {
    margin-bottom: 15px;
}

.input-type-selector label {
    display: block;
    margin: 8px 0;
    font-weight: bold;
    font-size: 14px;
}

.input-type-selector input[type="radio"] {
    margin-right: 8px;
}

.input-form {
    display: none;
    margin-top: 15px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
}

.input-form.active {
    display: block;
}

.input-form h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
}

/* AI Parameters Section */
.ai-parameters {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

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

.parameter-group:last-child {
    margin-bottom: 0;
}

.parameter-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: #495057;
    font-size: 14px;
}

.parameter-group input[type="range"] {
    width: 100%;
    margin: 8px 0;
    height: 5px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.parameter-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.parameter-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.parameter-group small {
    display: block;
    color: #6c757d;
    font-size: 11px;
    margin-top: 4px;
}

/* Responsive layout for parameters */
@media (min-width: 768px) {
    .ai-parameters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .parameter-group {
        margin-bottom: 0;
    }
}

input[type="text"], input[type="url"], input[type="file"], input[type="password"], textarea {
    width: 100%;
    padding: 8px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
}

input[readonly] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

textarea {
    height: 150px;
    resize: vertical;
}

button {
    background-color: #007cba;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 8px 4px;
}

button:hover {
    background-color: #005a87;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.query-section {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #f9f9f9;
}

/* Content Context Display */
.content-context-display {
    margin-bottom: 15px;
}

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

.content-context {
    padding: 12px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.content-context em {
    color: #666;
    font-style: italic;
}

.content-context .content-item {
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 2px 4px 2px 0;
    display: inline-block;
    font-size: 13px;
    color: #1976d2;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Query Input Group - Input and Button on same line */
.query-input-group {
    display: flex;
    gap: 0;
    align-items: center;
    margin: 8px 0;
}

.query-input-group input[type="text"] {
    flex: 0 0 85%;
    margin: 0;
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.query-input-group button {
    flex: 0 0 15%;
    margin: 0;
    white-space: nowrap;
    min-width: 60px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.response-area {
    margin-top: 15px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    min-height: 10rem;
}

.response-header {
    color: #007cba;
    font-size: 15px;
    border-bottom: 2px solid #007cba;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.response-content {
    line-height: 1.5;
    margin-bottom: 12px;
}

.response-footer {
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #007cba;
}

/* Remove old status-message styles since we're using the new status system */
.status-message {
    display: none;
}

/* Code blocks in documentation */
pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.3;
}

code {
    background-color: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Documentation styling */
.input-section h2, .input-section h3, .input-section h4, .input-section h5 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 12px;
}

.input-section ul {
    margin-left: 16px;
    margin-bottom: 12px;
}

.input-section li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.input-section p {
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
    }
    
    .right-panel {
        width: 100%;
        order: -1; /* Move to top on mobile */
    }
    
    .progress-section, .status-section {
        display: inline-block;
        width: calc(50% - 10px);
        vertical-align: top;
        margin-bottom: 15px;
        box-sizing: border-box;
    }
    
    /* Ensure proper spacing between inline elements */
    .progress-section {
        margin-right: 10px;
    }
    
    .status-section {
        margin-right: 10px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .main-container {
        gap: 10px;
    }
    
    .right-panel {
        width: 100%;
        order: -1; /* Move to top on mobile */
    }
    
    .progress-section, .status-section {
        width: 100%;
        display: block;
        margin-bottom: 10px;
    }
    
    .progress-section h3, .status-section h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .section-content {
        padding: 15px;
    }
    
    .input-section, .query-section {
        padding: 12px;
    }
    
    /* Mobile: Stack query input and button vertically */
    .query-input-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .query-input-group input[type="text"] {
        flex: 0 0 auto;
        width: 100%;
        border-right: 1px solid #ddd;
        border-top-right-radius: 4px;
        border-bottom-right-radius: 4px;
    }
    
    .query-input-group button {
        flex: 0 0 auto;
        width: 100%;
        min-width: auto;
        border-top-left-radius: 4px;
        border-bottom-left-radius: 4px;
    }
    
    button {
        width: 100%;
        margin: 4px 0;
    }
    
    h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .status-messages {
        max-height: 200px; /* Reduce height on mobile */
    }
    
    .status-item {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .status-time {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .main-container {
        gap: 8px;
    }
    
    .progress-section, .status-section {
        margin-bottom: 8px;
        padding: 12px;
    }
    
    .section-content {
        padding: 12px;
    }
    
    .input-section, .query-section {
        padding: 10px;
    }
    
    /* Extra small mobile: Further reduce spacing */
    .query-input-group {
        gap: 6px;
    }
    
    .query-input-group input[type="text"] {
        border-right: 1px solid #ddd;
        border-top-right-radius: 4px;
        border-bottom-right-radius: 4px;
    }
    
    .query-input-group button {
        border-top-left-radius: 4px;
        border-bottom-left-radius: 4px;
    }
    
    .status-messages {
        max-height: 150px; /* Further reduce height on very small screens */
    }
    
    .status-item {
        padding: 5px 6px;
        font-size: 10px;
    }
    
    .status-time {
        font-size: 8px;
    }
    
    h1 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .section-header {
        padding: 10px 12px;
    }
    
    .section-header h2 {
        font-size: 14px;
    }
} 