/* RAG Admin Styles */

/* Page Layout - Ensure proper scrolling */
html, body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    padding-bottom: 40px; /* Extra space at bottom */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 60px);
}

.header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
}

.header h1 {
    margin: 0 0 8px 0;
    color: #13294B;
}

.header-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.settings-btn {
    padding: 10px 16px;
    background: white;
    border: 2px solid #4B9CD3;
    border-radius: 6px;
    color: #4B9CD3;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: #4B9CD3;
    color: white;
}

.subtitle {
    margin: 0 0 16px 0;
    font-size: 14px;
    opacity: 0.9;
    font-weight: normal;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    overflow: visible; /* Changed from hidden to visible to prevent content cutoff */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #4B9CD3 0%, #13294B 100%);
    color: white;
}

.card-header h2 {
    margin: 0;
    font-size: 20px;
}

.card-body {
    padding: 24px;
}

/* Alert */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.alert strong {
    display: block;
    margin-bottom: 8px;
}

.alert-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* Index Management */
.index-info {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-weight: 600;
    color: #666;
}

.info-row .value {
    color: #13294B;
    font-weight: 500;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #4B9CD3;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.upload-area:hover {
    border-color: #13294B;
    background: #f8f9fa;
}

.upload-area.drag-over {
    border-color: #13294B;
    background: #e8f4f8;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.upload-area h3 {
    margin: 0 0 8px 0;
    color: #13294B;
}

.upload-area p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.upload-area input[type="file"] {
    display: none;
}

/* Form Rows */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #666;
    font-size: 12px;
}

.slider-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.slider-container input[type="range"] {
    flex: 1;
}

.slider-container input[type="number"] {
    width: 80px;
}

/* Info Panel */
.info-panel {
    background: #e8f4f8;
    border: 1px solid #4B9CD3;
    border-radius: 8px;
    padding: 16px;
}

.info-panel h4 {
    margin: 0 0 12px 0;
    color: #13294B;
}

.config-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.config-item {
    display: flex;
    justify-content: space-between;
}

.config-label {
    color: #666;
    font-size: 13px;
}

.config-value {
    color: #13294B;
    font-weight: 600;
    font-size: 13px;
}

/* Jobs List */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #999;
}

.job-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.job-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.job-card.processing {
    border-color: #4B9CD3;
}

.job-card.complete {
    border-color: #28a745;
}

.job-card.error {
    border-color: #dc3545;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.job-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-icon {
    font-size: 20px;
}

.file-name {
    font-weight: 600;
    color: #13294B;
}

.job-meta {
    font-size: 12px;
    color: #999;
}

.job-progress {
    margin-bottom: 12px;
}

.progress {
    background: #e0e0e0;
    border-radius: 4px;
    height: 24px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    background: linear-gradient(90deg, #4B9CD3, #13294B);
    color: white;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    transition: width 0.3s ease;
}

.status-text {
    font-size: 13px;
    color: #666;
}

.job-stats {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
}

.error-message {
    padding: 12px;
    background: #f8d7da;
    border: 1px solid #dc3545;
    border-radius: 4px;
    color: #721c24;
    font-size: 13px;
    margin-top: 12px;
}

/* Enhanced Error Display */
.error-details {
    margin-top: 16px;
    padding: 16px;
    background: #fff3cd;
    border: 2px solid #dc3545;
    border-radius: 8px;
}

.error-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(220, 53, 69, 0.2);
}

.error-icon {
    font-size: 20px;
    line-height: 1;
}

.error-title {
    font-weight: 700;
    font-size: 14px;
    color: #721c24;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error-details .error-message {
    margin-top: 0;
    padding: 12px;
    background: #fff;
    border: 1px solid #dc3545;
    border-radius: 6px;
    color: #721c24;
    font-size: 14px;
    line-height: 1.6;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.progress-bar.error-bar {
    background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4B9CD3;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #3a7ba8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Status Messages */
.status-message {
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 14px;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Modal Adjustments */
.modal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #000;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .config-summary {
        grid-template-columns: 1fr;
    }

    .header-actions {
        flex-direction: column;
        gap: 8px;
    }

    .settings-btn {
        width: 100%;
        font-size: 13px;
    }

    .card {
        margin-bottom: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .upload-area {
        padding: 32px 16px;
    }

    .job-stats {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 24px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    .btn {
        width: 100%;
        padding: 12px 16px;
    }

    .form-actions {
        flex-direction: column;
    }
}
