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

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #f5f7fa;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* Typography */
h1 {
    font-size: 24px;
    font-weight: 700;
    color: #4338ca;
    margin: 16px 0 24px 0;
    text-align: center;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    color: #4338ca;
    margin-bottom: 16px;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Card styles */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 24px;
}

/* Form elements */
.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

input[type="text"],
input[type="file"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: #f9fafb;
}

button {
    background-color: #4f46e5;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #4338ca;
}

button:disabled,
button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Progress indicators */
.progress-section {
    margin-top: 16px;
}

.progress-container {
    width: 100%;
    background-color: #e5e7eb;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #4f46e5;
    transition: width 0.3s ease;
}

.status-text {
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

.error-text {
    color: #ef4444;
}

/* Spinner */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: #eef2ff;
    border-radius: 8px;
    margin: 16px 0;
}

/* Chunking options */
.chunking-section {
    margin: 16px 0;
}

.section-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.chunking-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.chunking-option {
    display: flex;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    align-items: flex-start;
}

.chunking-option input[type="radio"] {
    margin-top: 3px;
}

.chunking-option div {
    margin-left: 8px;
}

.option-label {
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

.option-description {
    font-size: 12px;
    color: #6b7280;
}

/* Summary */
.summary-section {
    padding: 16px;
    background-color: #eef2ff;
    border-left: 4px solid #4f46e5;
    border-radius: 4px;
    margin: 16px 0;
}

/* Results */
.results-section {
    margin-top: 16px;
}

.result-item {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background-color: #f9fafb;
    margin-bottom: 12px;
}

.result-source {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.source-label {
    font-weight: 500;
}

.chunk-label {
    color: #4f46e5;
}

.token-count {
    background-color: #eef2ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.result-content {
    white-space: pre-line;
}

/* Document list */
.document-item {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background-color: #f9fafb;
    margin-bottom: 12px;
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.document-title {
    font-weight: 500;
    color: #4338ca;
}

.document-delete {
    color: #ef4444;
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 14px;
}

.document-delete:hover {
    background-color: #fee2e2;
    border-radius: 4px;
}

.document-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
    margin-top: 12px;
}

.info-label {
    font-weight: 500;
}

.tag {
    background-color: #eef2ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-block;
}

/* Info box */
.info-box {
    padding: 16px;
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 4px;
    margin-bottom: 16px;
}

.info-box h3 {
    color: #92400e;
}

/* Empty and error states */
.empty-state, .error-state {
    text-align: center;
    padding: 24px;
    border-radius: 4px;
    background-color: #f9fafb;
    color: #6b7280;
}

.error-state {
    background-color: #fee2e2;
    color: #ef4444;
}

.hidden {
    display: none;
}

/* Utility for error alerts */
.error-alert {
    padding: 12px;
    background-color: #fee2e2;
    color: #ef4444;
    border-radius: 4px;
    margin-bottom: 16px;
}

/* Responsive adjustments */
@media (min-width: 640px) {
    .form-row {
        flex-direction: row;
        gap: 12px;
    }
    
    .form-row input {
        flex-grow: 1;
        margin-bottom: 0;
    }
    
    .chunking-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .document-info {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 28px;
        text-align: left;
    }
}

@media (min-width: 768px) {
    .chunking-options {
        grid-template-columns: repeat(4, 1fr);
    }
}
