/* Pharmint — Фармацевтическая Интеллектуальная платформа */
:root {
    --pharmint-primary: #2c5282;
    --pharmint-primary-hover: #2a4365;
    --pharmint-border: #e2e8f0;
    --pharmint-bg: #f7fafc;
    --pharmint-card-bg: #ffffff;
    --pharmint-section-title: #1a202c;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: #2d3748;
}

.pharmint-body {
    background-color: var(--pharmint-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.pharmint-header {
    background: var(--pharmint-card-bg);
    border-bottom: 1px solid var(--pharmint-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pharmint-brand {
    font-size: 1.15rem;
    font-weight: 600;
}

.pharmint-logo {
    height: 1.75rem;
    margin-right: 0.6rem;
}

.pharmint-subtitle {
    font-size: 0.9rem;
}

.pharmint-page-header {
    background: var(--pharmint-card-bg);
    border: 1px solid var(--pharmint-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 0.9rem 1rem;
}

.pharmint-lang-flag {
    min-width: 2.4rem;
    line-height: 1;
    font-size: 1rem;
    padding: 0.3rem 0.55rem;
}

.pharmint-main {
    flex: 1;
}

.pharmint-section {
    margin-bottom: 2rem;
}

.pharmint-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--pharmint-section-title);
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--pharmint-primary);
    display: inline-block;
}

.pharmint-card {
    border: 1px solid var(--pharmint-border);
    border-radius: 8px;
    background: var(--pharmint-card-bg);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pharmint-card:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.pharmint-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2d3748;
}

.btn-pharmint {
    background-color: var(--pharmint-primary);
    border-color: var(--pharmint-primary);
    color: #fff;
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
}

.btn-pharmint:hover {
    background-color: var(--pharmint-primary-hover);
    border-color: var(--pharmint-primary-hover);
    color: #fff;
}

.pharmint-footer {
    background: var(--pharmint-card-bg);
    border-top: 1px solid var(--pharmint-border);
    font-size: 0.8rem;
    color: #718096;
}

/* Override Bootstrap styles for better integration */
.card {
    border: 1px solid var(--pharmint-border);
    border-radius: 8px;
}

.card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--pharmint-border);
    font-weight: 600;
}

.card.shadow-sm {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06) !important;
}

.nav-tabs {
    border-bottom-color: var(--pharmint-border);
}

.nav-tabs .nav-link {
    color: #475569;
    border: 1px solid transparent;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    color: #1e293b;
    border-color: #e2e8f0 #e2e8f0 var(--pharmint-border);
    background-color: #f8fafc;
}

.nav-tabs .nav-link.active {
    color: var(--pharmint-primary);
    background-color: #fff;
    border-color: var(--pharmint-border) var(--pharmint-border) #fff;
}

/* Custom button styles */
.btn-outline-primary {
    border-color: #4e73df;
    color: #4e73df;
}

.btn-outline-primary:hover {
    background-color: #4e73df;
    border-color: #4e73df;
}

.btn-outline-secondary {
    border-color: #858796;
    color: #858796;
}

.btn-outline-secondary:hover {
    background-color: #858796;
    border-color: #858796;
}

/* File list styling */
#file-list {
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e3e6f0;
}

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

.file-name {
    font-size: 0.9rem;
    color: #5a5c69;
}

.file-manager {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-manager-section {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background-color: #f8fafc;
}

.file-manager-section:not(:last-child) {
    margin-bottom: 0.5rem;
}

.file-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4e73df;
    margin-bottom: 0.5rem;
}

.file-manager .input-group {
    border: 1px solid #dbe4f0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
}

.file-manager .input-group .form-control,
.file-manager .input-group .btn {
    border: 0;
}

/* Unified upload controls across modules */
.file-manager .btn[id$="UploadBtn"],
.file-manager .btn[id*="UploadBtn"],
#knowledgeBaseUploadBtn,
#emptyStateUploadBtn {
    min-height: 2.35rem;
    font-weight: 500;
}

.file-manager .input-group .btn[id$="UploadBtn"],
.file-manager .input-group .btn[id*="UploadBtn"] {
    min-width: 2.75rem;
}

.file-manager .btn[id$="UploadBtn"] i,
.file-manager .btn[id*="UploadBtn"] i,
#knowledgeBaseUploadBtn i,
#emptyStateUploadBtn i {
    font-size: 0.95rem;
}

.file-manager .btn[id$="UploadBtn"] i:not(:only-child),
.file-manager .btn[id*="UploadBtn"] i:not(:only-child),
#knowledgeBaseUploadBtn i:not(:only-child),
#emptyStateUploadBtn i:not(:only-child) {
    margin-right: 0.35rem;
}

input[type="file"].form-control {
    min-height: 2.4rem;
}

/* Unified auth pages */
.auth-page {
    background: linear-gradient(160deg, #f3f6fb 0%, #e8eef8 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border: 1px solid var(--pharmint-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    padding: 1.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.auth-logo {
    height: 3.6rem;
}

.auth-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.75rem;
    color: #1f2937;
}

.auth-link {
    color: var(--pharmint-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-link:hover {
    color: var(--pharmint-primary-hover);
    text-decoration: underline;
}

.file-manager-list {
    max-height: 240px;
    overflow-y: auto;
}

.file-manager-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f9;
}

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

.file-manager-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: #f8f9fc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4e73df;
}

.file-manager-info {
    flex: 1;
    min-width: 0; /* allow text truncation inside */
}

.file-manager-title {
    font-weight: 600;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.file-manager-title .text-truncate {
    flex: 1;
    min-width: 0;
}

.file-manager-meta {
    font-size: 0.8rem;
    color: #858796;
}

.file-manager-empty {
    font-size: 0.85rem;
    color: #adb5bd;
    text-align: center;
    padding: 0.75rem 0;
}

.file-manager-delete {
    border-color: #e74a3b;
    color: #e74a3b;
    flex-shrink: 0; /* keep delete button visible */
}

.file-manager-delete:hover {
    background-color: #e74a3b;
    color: #fff;
}

/* Ensure truncation in PV document list and keep actions visible */
.list-group-item.d-flex .flex-grow-1 {
    min-width: 0;
}

.list-group-item.d-flex .btn {
    flex-shrink: 0;
}

/* Knowledge base table styling */
#knowledgeBaseListContainer table {
    table-layout: fixed;
    width: 100%;
}

#knowledgeBaseListContainer td.filename {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

#knowledgeBaseListContainer td.filename > div {
    min-width: 0;
}

#knowledgeBaseListContainer .text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* Pagination styling */
.list-pagination {
    margin: 0;
    display: flex;
    list-style: none;
    padding: 0;
    gap: 0.25rem;
}

.list-pagination li {
    display: inline-block;
}

/* PDF compare diff highlighting */
.bg-insert {
    background-color: #d1e7dd;
    color: #0f5132;
}

.bg-delete {
    background-color: #f8d7da;
    color: #842029;
}

ins {
    background-color: #d4fcbc;
    text-decoration: none;
}

del {
    background-color: #fbb6c2;
    text-decoration: line-through;
}

.list-pagination a,
.list-pagination span {
    display: block;
    padding: 0.375rem 0.75rem;
    margin-left: 0;
    line-height: 1.5;
    color: #0d6efd;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: pointer;
}

.list-pagination a:hover {
    z-index: 2;
    color: #0a58ca;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.list-pagination .active a,
.list-pagination .active span {
    z-index: 3;
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.list-pagination .disabled a,
.list-pagination .disabled span {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
    cursor: not-allowed;
}

.list-count {
    font-size: 0.875rem;
}

/* Answer area styling */
#answer {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

#answer pre {
    white-space: pre-wrap;
}

/* Stats table styling */
.stats-table {
    font-size: 0.9rem;
}

.stats-table th {
    background-color: #f8f9fc;
    font-weight: 600;
    color: #5a5c69;
    border-top: none;
}

.stats-table td {
    color: #858796;
    vertical-align: middle;
}

/* Progress indicators */
.progress {
    height: 1rem;
    background-color: #eaecf4;
}

.progress-bar {
    background-color: #4e73df;
}

/* Message styling */
.success-message {
    color: #1cc88a;
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    padding: 0.75rem 1rem;
    border-radius: 0.35rem;
    margin: 0.5rem 0;
}

.error-message {
    color: #e74a3b;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 0.75rem 1rem;
    border-radius: 0.35rem;
    margin: 0.5rem 0;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .pharmint-page-header {
        padding: 0.75rem;
    }

    .pharmint-page-header h1,
    .pharmint-page-header h2 {
        font-size: 1.05rem;
        width: 100%;
    }

    .pharmint-page-header .form-label {
        display: none;
    }

    .pharmint-page-header .d-flex.align-items-center.gap-3.flex-wrap {
        width: 100%;
        justify-content: space-between;
    }

    .file-manager .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .file-manager .input-group .btn {
        width: 100%;
        border-top: 1px solid #e2e8f0;
        border-radius: 0;
    }

    .auth-container {
        padding: 1.1rem;
        border-radius: 10px;
    }

    .table-responsive {
        border: 1px solid #e2e8f0;
        border-radius: 0.5rem;
        background: #fff;
    }

    .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem !important;
    }

    .btn-sm {
        width: 100%;
    }
}

/* Progress bar styles */
.progress-container {
    margin: 15px 0;
}

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

.progress-fill {
    height: 100%;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-animation 2s infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Results container styles */
.results-container {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.results-container h3 {
    margin-top: 0;
    color: #2c3e50;
}

/* Stats table styles */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stats-table th,
.stats-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.stats-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.stats-table tr:hover {
    background-color: #f5f5f5;
}

/* Success/error message styles */
.success-message {
    color: #27ae60;
    background-color: #d5f4e6;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

.error-message {
    color: #e74c3c;
    background-color: #fadbd8;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
} 
.answer-content p {
    margin-bottom: 0.75rem;
}

.answer-content p:last-child {
    margin-bottom: 0.4rem;
}
