@import "https://www.tchitchui.com/index.css";

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin-right: auto;
    margin-left: max(150px, calc((100% - min(1200px, 100%)) / 2));
    background: rgba(200, 200, 200, 0.1);
    border-radius: 20px;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--theme-background-color-0) 0%, var(--theme-background-color-1) 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.stats-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    backdrop-filter: blur(5px);
}

.stats-section {
    padding: 20px 30px;
    background: transparent;
    border-bottom: 1px solid #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: rgba(200, 200, 200, 0.1);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--theme-background-color-0);
    margin-bottom: 5px;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-section, .documents-section, .qa-section {
    padding: 30px;
    border-bottom: 1px solid #333;
}

.upload-section h2, .documents-section h2, .qa-section h2 {
    color: #dedede;
    margin-bottom: 20px;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0.1px;
    height: 0.1px;
}

.file-label {
    display: inline-block;
    padding: 12px 24px;
    background: var(--theme-background-color-0);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

.file-label:hover {
    background: var();
}

#filePreprocess {
    display: none;
}

.file-list {
    margin: 15px 0;
    padding: 15px;
    border-radius: 8px;
    min-height: 50px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin: 5px;
    background: rgba(200, 200, 200, 0.07);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(200, 200, 200, 0.1);
    color: #dedede;
}

.remove-file {
    color: #e53e3e;
    cursor: pointer;
    font-weight: bold;
}

button {
    padding: 12px 24px;
    background: var(--theme-background-color-1);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

button:hover:not(:disabled) {
    background: var(--theme-background-color-1);
}

button:disabled {
    background: rgba(200, 200, 200, 0.5);
    cursor: not-allowed;
}

.document-list {
    padding: 15px;
    background: rgba(200, 200, 200, 0.07);
    color: #bbb;
    border-radius: 8px;
    min-height: 100px;
}

.document-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: rgba(200,200,200,0.1);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(200,200,200,0.1);
}

.document-info {
    flex: 1;
}

.document-name {
    font-weight: bold;
    color: #bbb;
}

.document-status {
    font-size: 0.9em;
    color: #48bb78;
}

.delete-doc {
    background: #f56565;
    padding: 8px 16px;
    font-size: 0.9em;
}

.delete-doc:hover {
    background: #e53e3e;
}

.question-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#question {
    flex: 1;
    padding: 15px;
    border: 2px solid #333;
    background-color: rgba(200, 200, 200, 0.07);
    color: #dedede;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

#question:focus {
    outline: none;
    border-color: var(--theme-background-color-0);
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--theme-background-color-0);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.answer {
    padding: 20px;
    background: rgba(200, 200, 200, 0.07);
    border-radius: 8px;
    border-left: 4px solid var(--theme-background-color-0);
}

.answer h3, .sources h4 {
    color: #fff;
    margin-bottom: 10px;
}

#answerText {
    line-height: 1.6;
    color: #dedede;
}

.sources {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(200, 200, 200, 0.3);
}

.sources ul {
    list-style: none;
    padding: 10px 0;
}

.sources li {
    padding: 5px 0;
    color: var(--theme-background-color-0);
    font-size: 0.9em;
}

.hidden {
    display: none;
}

.no-docs {
    color: #dedede;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

@media (max-width: 768px) {
    .container {
        border-radius: 10px;
        margin-left: 10px;
        margin-right: 10px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .upload-section, .documents-section, .qa-section {
        padding: 20px;
    }
    
    .question-input {
        flex-direction: column;
    }
}