/* Base styles - body and container styles are inherited from shared base.html */

/* Scope content styles to avoid overriding header */
.container h1 {
    color: #333;
    margin-top: 0;
}

/* Form styles */
.container form {
    margin: 20px 0;
}

.container textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.container button {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.container button:hover {
    background: #2980b9;
}

/* Loading state */
.loading-container {
    text-align: center;
    padding: 40px;
    background: #f0f8ff;
    border-radius: 4px;
    margin-top: 20px;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-bottom: 10px;
}

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

/* Results */
.result-container {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.result-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* Service Information Grid */
.result-section {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.result-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #34495e;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-item strong {
    color: #7f8c8d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-item span {
    color: #2c3e50;
    font-size: 15px;
}

/* Sentiment Badge */
.sentiment-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}

.sentiment-positive {
    background: #d4edda;
    color: #155724;
}

.sentiment-negative {
    background: #f8d7da;
    color: #721c24;
}

.sentiment-neutral {
    background: #d1ecf1;
    color: #0c5460;
}

/* Result Cards */
.result-card {
    background: white;
    padding: 18px;
    margin: 15px 0;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #3498db;
}

.result-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #34495e;
    font-size: 15px;
}

/* Medications Card */
.result-card.medications {
    border-left-color: #9b59b6;
}

.result-card.medications h3 {
    color: #8e44ad;
}

/* Concerns Card */
.result-card.concerns {
    border-left-color: #e74c3c;
    background: #fff5f5;
}

.result-card.concerns h3 {
    color: #c0392b;
}

/* Lists */
.activities-list,
.medications-list,
.concerns-list,
.next-actions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activities-list li,
.medications-list li,
.concerns-list li,
.next-actions-list li {
    padding: 10px 12px;
    margin: 6px 0;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.medications-list li {
    border-left-color: #9b59b6;
    background: #f5f0f8;
}

.concerns-list li {
    border-left-color: #e74c3c;
    background: #ffe6e6;
    font-weight: 500;
}

.next-actions-list li {
    border-left-color: #27ae60;
    background: #e8f8f5;
}

/* Observations */
.observations-text {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    line-height: 1.6;
    color: #2c3e50;
    margin: 0;
}

/* Footer */
.result-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
    text-align: right;
}

.confidence-label {
    color: #7f8c8d;
    font-size: 14px;
    margin-right: 10px;
}

.confidence-value {
    font-size: 18px;
    font-weight: bold;
    color: #27ae60;
}

/* Error state */
.error-container {
    margin-top: 20px;
    padding: 20px;
    background: #ffebee;
    border-radius: 4px;
    border-left: 4px solid #f44336;
}

.error-message {
    color: #c62828;
    font-weight: bold;
}
/* Page Header with buttons */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header p {
    margin: 5px 0 0 0;
    color: #666;
}

.btn-history, .btn-new-analysis {
    display: inline-block;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-history:hover, .btn-new-analysis:hover {
    background: #2980b9;
}

.btn-new-analysis {
    background: #27ae60;
}

.btn-new-analysis:hover {
    background: #229954;
}

.back-link {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    margin-bottom: 10px;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-date {
    color: #7f8c8d;
    font-size: 14px;
    margin: 5px 0 0 0;
}

/* Analysis Grid (List View) */
.analysis-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.analysis-card-link {
    text-decoration: none;
    color: inherit;
}

.analysis-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.analysis-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #3498db;
    transform: translateY(-2px);
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.analysis-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.analysis-id {
    font-weight: bold;
    color: #495057;
    font-size: 16px;
}

.analysis-date {
    color: #6c757d;
    font-size: 14px;
}

.analysis-info {
    margin: 15px 0;
}

.info-row {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    font-size: 14px;
}

.info-row strong {
    color: #495057;
    min-width: 100px;
}

.info-row span {
    color: #212529;
}

.analysis-preview {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    color: #495057;
    font-size: 14px;
    line-height: 1.5;
    margin: 15px 0;
    border-left: 3px solid #dee2e6;
}

.analysis-footer {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e7f3ff;
    color: #0366d6;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag.medications {
    background: #f5f0f8;
    color: #8e44ad;
}

.tag.concerns {
    background: #ffe6e6;
    color: #c0392b;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 30px 0;
}

.page-link {
    padding: 8px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #3498db;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.page-current {
    padding: 8px 16px;
    color: #495057;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state a {
    color: #3498db;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Original Text Card (Detail View) */
.original-text-card {
    border-left-color: #6c757d;
    margin-bottom: 20px;
}

.original-text {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    line-height: 1.8;
    color: #212529;
    white-space: pre-wrap;
    margin: 0;
}

/* Chat-like Comments Section */
.comments-section-chat {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
}

.comments-section-chat h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #856404;
    font-size: 16px;
}

.comment-bubble {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    max-width: 85%;
}

.comment-bubble.comment-own {
    margin-left: auto;
    background: #e7f3ff;
    border-color: #b8d4f0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.comment-author-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.comment-author-name {
    color: #495057;
    font-size: 13px;
}

.comment-timestamp {
    color: #adb5bd;
    font-size: 12px;
}

.comment-edited {
    color: #adb5bd;
    font-size: 11px;
    font-style: italic;
}

.comment-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.btn-comment-action {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 12px;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 3px;
    margin: 0;
}

.btn-comment-action:hover {
    background: #e9ecef;
    color: #495057;
}

.btn-comment-delete:hover {
    background: #f8d7da;
    color: #721c24;
}

.comment-body {
    color: #212529;
    font-size: 14px;
    line-height: 1.5;
}

/* Add comment form */
.comment-add-form {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.comment-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-input-row textarea {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    box-sizing: border-box;
}

.comment-input-row textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-comment-send {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
    white-space: nowrap;
}

.btn-comment-send:hover {
    background: #2980b9;
}

/* Inline edit form */
.comment-editing textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #3498db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.comment-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-comment-save {
    background: #27ae60;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    margin: 0;
}

.btn-comment-save:hover {
    background: #229954;
}

.btn-comment-cancel {
    background: #e9ecef;
    color: #495057;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    margin: 0;
}

.btn-comment-cancel:hover {
    background: #dee2e6;
}

.comments-empty {
    color: #adb5bd;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.comments-login-prompt {
    text-align: center;
    color: #6c757d;
    padding: 15px;
}

.comments-login-prompt a {
    color: #3498db;
}

/* Version badge in list */
.version-badge {
    font-size: 11px;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Filters Section */
.filters-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.filters-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: nowrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 14px;
    min-width: 160px;
    background: white;
    color: #333;
    transition: all 0.2s;
}

.filter-group select:hover,
.filter-group input:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.btn-filter {
    background: #27ae60;
    color: white;
    border: none;
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-filter:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-clear-filters {
    padding: 9px 18px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-clear-filters:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* Responsive filters for smaller screens */
@media (max-width: 1200px) {
    .filters-form {
        flex-wrap: wrap;
    }
}

/* Resubmit Button */
.btn-resubmit {
    padding: 10px 12px;
    background: #17a2b8;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-resubmit:hover {
    background: #138496;
}

.analysis-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Resubmit Notice */
.resubmit-notice {
    color: #17a2b8;
    font-weight: 600;
    font-size: 14px;
    margin-top: 5px;
}

/* Technical Metadata Display */
.technical-metadata {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-top: 20px;
    border-left: 4px solid #6c757d;
}

.technical-metadata h3 {
    margin-top: 0;
    color: #495057;
    font-size: 15px;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metadata-item strong {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-item span {
    font-size: 14px;
    color: #212529;
}

.system-info-details {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-size: 13px;
    font-family: monospace;
}
