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

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --hover-bg: #f1f5f9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

header h1 i {
    margin-right: 0.5rem;
}

.server-config {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.server-config label {
    font-weight: 500;
}

.server-config input {
    padding: 0.5rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    min-width: 300px;
}

.server-config input::placeholder {
    color: rgba(255,255,255,0.7);
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}

.sidebar h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resource-types {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.resource-type {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.resource-type:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.resource-type.active {
    background: var(--primary-color);
    color: white;
}

.resource-type i {
    width: 20px;
    text-align: center;
}

.search-box {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.search-box h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-color);
}

.toolbar {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.breadcrumb-item {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.breadcrumb-item.active {
    color: var(--primary-color);
    font-weight: 500;
}

.breadcrumb-item::after {
    content: '/';
    margin-left: 0.5rem;
    color: var(--text-secondary);
}

.breadcrumb-item:last-child::after {
    display: none;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
}

.results {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.welcome {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.welcome i {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.resource-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.resource-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.resource-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.resource-card .meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.resource-card .meta span {
    display: block;
    margin: 0.25rem 0;
}

.resource-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resource-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resource-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.resource-item-info {
    flex: 1;
}

.resource-item-info h4 {
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.resource-item-info .meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 4px;
}

.btn-icon:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.loading, .error {
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
}

.loading {
    color: var(--primary-color);
}

.error {
    color: var(--danger-color);
    background: #fee2e2;
    border-radius: 8px;
    margin: 1rem;
}

.hidden {
    display: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow: auto;
}

.modal-content-inner {
    width: 100%;
}

.modal-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Resource Detail Views */
.resource-detail-view {
    padding: 0;
}

.detail-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.detail-section h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.detail-section .description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.detail-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.detail-table thead {
    background: var(--hover-bg);
}

.detail-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.detail-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.detail-table tbody tr:hover {
    background: var(--hover-bg);
}

.detail-table code {
    background: #f1f5f9;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--primary-color);
}

.codes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--hover-bg);
    border-radius: 6px;
}

.code-item {
    padding: 0.5rem;
    background: var(--card-bg);
    border-radius: 4px;
    font-size: 0.9rem;
}

.code-item code {
    font-weight: 600;
    color: var(--primary-color);
}

.code-display {
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.mapping-direction {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    margin-top: 1rem;
}

.mapping-source,
.mapping-target {
    flex: 1;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mapping-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

.mapping-table {
    font-size: 0.85rem;
}

.mapping-table .arrow-cell {
    text-align: center;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

.equivalence-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.equivalence-equivalent {
    background: #d1fae5;
    color: #065f46;
}

.equivalence-wider {
    background: #dbeafe;
    color: #1e40af;
}

.equivalence-narrower {
    background: #fef3c7;
    color: #92400e;
}

.equivalence-relatedto {
    background: #fce7f3;
    color: #9f1239;
}

.no-mapping {
    color: var(--text-secondary);
    font-style: italic;
}

.json-view {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.5rem 0;
    font-style: italic;
}

.note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 300px;
    }
    
    .server-config {
        width: 100%;
    }
    
    .server-config input {
        min-width: 200px;
        flex: 1;
    }
    
    .mapping-direction {
        flex-direction: column;
    }
    
    .mapping-arrow {
        transform: rotate(90deg);
    }
    
    .detail-table {
        font-size: 0.75rem;
    }
    
    .codes-list {
        grid-template-columns: 1fr;
    }
}

