/* Medical System Dashboard Styles */

:root {
    --primary-color: #003366;
    --secondary-color: #0066cc;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header */
.header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.user-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-menu span {
    font-size: 0.95rem;
}

/* Container */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    gap: 0;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: white;
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
    height: 100%;
    overflow-y: auto;
}

.nav-menu {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--text-dark);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--light-bg);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

/* Main Content */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #002244;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #0052a3;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-logout {
    background-color: transparent;
    color: white;
    border: 1px solid white;
    padding: 0.5rem 1rem;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Search Section */
.search-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-section input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Results Section */
.results-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.result-item:hover {
    background-color: var(--light-bg);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.result-details h5 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.tag {
    display: inline-block;
    background-color: #e9ecef;
    color: var(--text-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-right: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

/* Info Section */
.info-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.info-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-section ul {
    margin-left: 2rem;
}

.info-section li {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

/* Interaction Form */
.interaction-form {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.interaction-form .form-group {
    width: 100%;
}

/* Research Section */
.research-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.research-section .btn {
    margin-top: 1rem;
    margin-right: 1rem;
}

/* Sync Section */
.sync-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.sync-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.status-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    display: none;
}

.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

/* History List */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-time {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Settings Section */
.settings-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.settings-section p {
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
}

.auth-modal {
    width: 100%;
    max-width: 400px;
}

.auth-modal h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.auth-modal .form-group {
    margin-bottom: 1rem;
}

.auth-modal .btn {
    width: 100%;
    margin-top: 1rem;
}

.error-message {
    color: var(--danger-color);
    margin-top: 1rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* Sync Progress Modal Styles */
.sync-progress-modal {
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sync-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.sync-progress-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.4rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--text-dark);
}

.sync-progress-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
}

.progress-item {
    margin-bottom: 1.2rem;
}

.progress-item label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-value {
    background-color: var(--light-bg);
    padding: 0.75rem;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-word;
}

.progress-bar-container {
    background-color: var(--light-bg);
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.debug-console {
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: #1e1e1e;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}

.debug-header {
    padding: 0.75rem;
    background-color: #2d2d2d;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: #00ff00;
}

.debug-log-content {
    height: 150px;
    overflow-y: auto;
    padding: 0.75rem;
}

.debug-log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid #333;
}

.debug-log-entry:last-child {
    border-bottom: none;
}

.progress-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.sync-progress-footer {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.sync-progress-footer .btn {
    margin-left: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem 0;
    }

    .nav-menu {
        display: flex;
        flex-wrap: wrap;
    }

    .nav-link {
        flex: 1;
        min-width: 150px;
        padding: 0.6rem 1rem;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .nav-link.active {
        border-left: none;
        border-bottom-color: var(--primary-color);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-section {
        flex-direction: column;
    }

    .search-section input,
    .search-section button {
        width: 100%;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .user-menu {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 1rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 51, 102, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}
/* Filter Results and List Items */
.result-item {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-item:hover {
    background-color: #f0f7ff;
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.2);
    transform: translateX(4px);
}

.item-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-size: 1rem;
}

.item-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.item-id {
    font-size: 0.85rem;
    color: #999;
    font-family: 'Courier New', monospace;
}

.item-description {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-top: 0.4rem;
    line-height: 1.4;
}

.interaction-item {
    border-left: 4px solid var(--warning-color);
}

.item-interaction-pair {
    font-size: 1rem;
    margin-bottom: 0.4rem;
    color: var(--primary-color);
}

.item-severity {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.severity-low {
    color: #28a745;
    background-color: #d4edda;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    display: inline-block;
    font-weight: 600;
}

.severity-moderate {
    color: #856404;
    background-color: #fff3cd;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    display: inline-block;
    font-weight: 600;
}

.severity-high {
    color: #721c24;
    background-color: #f8d7da;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    display: inline-block;
    font-weight: 600;
}

.item-interaction-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid #eee;
}

/* Filter Input Styling */
.filter-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.filter-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.filter-count strong {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Results Container */
.results-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    background-color: white;
}

.results-container.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

/* Data Grid View */
.data-grid-container {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin-bottom: 1rem;
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-grid thead {
    background-color: var(--primary-color);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-grid th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.data-grid td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.data-grid tbody tr:hover {
    background-color: var(--light-bg);
}

.data-grid tbody tr:last-child td {
    border-bottom: none;
}

.data-grid .empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: white;
    color: var(--text-dark);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-width: 40px;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

.pagination-info {
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 1rem;
}

.pagination-jump input {
    width: 60px;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

.pagination-jump button {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    background-color: white;
    color: var(--text-dark);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.pagination-jump button:hover {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}