:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --success: #27ae60;
    --light: #ecf0f1;
    --border: #bdc3c7;
    --text: #333;
    --code-bg: #f6f8fa;
    --code-border: #e1e4e8;
    --focus-ring: rgba(52, 152, 219, 0.4);

    --app-width: 700px;
    --narrow-width: 400px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f9f9f9;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding-top: 2rem;
    padding-bottom: 5rem;
    gap: 2rem;
    overflow-y: scroll;
}

.container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    box-sizing: border-box;
    width: var(--app-width);
    max-width: var(--app-width);
    min-width: var(--app-width);
}

.container-narrow {
    width: var(--narrow-width);
    max-width: var(--narrow-width);
    min-width: var(--narrow-width);
}

.data-container {
    background: white;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    width: var(--app-width);
    max-width: var(--app-width);
    min-width: var(--app-width);
    height: 600px;
}

.view-controls {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    background-color: #f1f2f6;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

.view-btn {
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #666;
}

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

.input-group {
    position: relative;
    margin-bottom: 2rem;
    width: 100%;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"], input[type="date"], select {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.go-btn, .portal-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 48px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    text-align: center;
}

.go-btn {
    background-color: var(--success);
    color: white;
    text-transform: uppercase;
}

.go-btn:not(:disabled):hover {
    background-color: #219150;
}

.go-btn:disabled {
    background-color: var(--light);
    color: #999;
    cursor: not-allowed;
    border: 1px solid var(--border);
}

.portal-btn {
    background-color: white;
    border: 1px solid var(--border);
    color: var(--primary);
    margin-bottom: 15px;
}

.portal-btn:hover {
    border-color: var(--secondary);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    color: var(--secondary);
}

pre {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    padding: 1rem;
    margin: 0;
}

.table-scroll-wrapper {
    flex: 1;
    overflow: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    position: relative;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: auto;
}

th {
    background-color: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    text-align: left;
    padding: 10px;
    font-weight: 600;
    z-index: 5;
    white-space: nowrap;
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #eef2f7;
}

.table-scroll-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 4px;
}

.document-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    background: white;
}

.doc-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.global-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
}

.nav-item {
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.code-pill {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #24292e;
    display: inline-flex;
    align-items: center;
}

.crumb-remove {
    margin-left: 8px;
    cursor: pointer;
    color: #e74c3c;
    font-weight: bold;
    font-family: sans-serif;
    font-size: 10px;
    opacity: 0.6;
}

.crumb-remove:hover {
    opacity: 1;
}

.category-browser, .concept-display-container {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.crumb-row {
    display: flex;
    align-items: center;
    padding: 2px 0;
}

.tree-connector {
    color: #bdc3c7;
    margin-right: 8px;
    font-family: monospace;
    white-space: pre;
}

.results-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: none;
}

.results-list.active {
    display: block;
}

.result-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.result-item:hover {
    background-color: var(--light);
}

.result-item .meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.checkbox-wrapper input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-wrapper label {
    margin-bottom: 0;
    cursor: pointer;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-label input {
    margin-right: 8px;
}

.spinner {
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.api-url-container {
    margin-top: 1rem;
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.api-url-text {
    font-family: monospace;
    font-size: 0.8rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.copy-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    width: 24px;
    height: 24px;
}

.copy-btn:hover {
    background-color: #e1e4e8;
    color: var(--primary);
}

.copy-btn svg {
    width: 14px;
    height: 14px;
}

.hidden {
    display: none;
}