/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-hover: #21262d;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-primary: #58a6ff;
    --accent-secondary: #1f6feb;
    --accent-success: #3fb950;
    --accent-warning: #d29922;
    --accent-error: #f85149;
    --code-bg: #0d1117;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --header-height: 73px;
    /* Approximate height */
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    z-index: 100;
}

.header-content {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: 2rem;
}

.logo-icon {
    font-size: 1.5rem;
}

/* ===== Tabs ===== */
.header-tabs {
    flex: 1;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

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

.tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.header-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.85rem;
}

.stat {
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-divider {
    color: var(--border-color);
}

/* ===== View Containers ===== */
#view-api {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Manage scroll internally */
}


/* ===== Controls ===== */
.controls {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

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

.filter-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b949e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.filter-select:hover {
    border-color: var(--accent-primary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.btn-clear {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* ===== Main Layout ===== */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    /* Constrain height */
    max-width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    background: var(--accent-secondary);
    color: var(--text-primary);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.class-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* Scrollbar styles for class-nav inside sidebar */
.class-nav::-webkit-scrollbar {
    width: 6px;
}

.class-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.package-group {
    margin-bottom: 0.5rem;
}

.package-header {
    padding: 0.5rem 1.5rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.class-link {
    display: block;
    padding: 0.6rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.class-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--accent-primary);
}

.class-link.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    font-weight: 500;
}

/* ===== Content Area ===== */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg-primary);
}

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

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

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

.class-section {
    margin-bottom: 3rem;
}

.class-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.class-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.class-package {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-family: var(--font-mono);
}

.methods-section {
    margin-top: 2rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.method-count {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

.methods-grid {
    display: grid;
    gap: 1rem;
}

.method-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.method-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.method-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.visibility-badge {
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.visibility-public {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.visibility-private {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-error);
}

.visibility-protected {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

.visibility-package-private {
    background: rgba(139, 148, 158, 0.15);
    color: var(--text-secondary);
}

.method-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    flex: 1;
}

.static-badge {
    padding: 0.25rem 0.6rem;
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.method-signature {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow-x: auto;
    margin-top: 1rem;
}

.return-type {
    color: var(--accent-success);
}

.param-type {
    color: var(--accent-warning);
}

.param-name {
    color: var(--text-secondary);
}

.method-details {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.method-description {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.return-description {
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-style: italic;
}

.detail-row {
    display: flex;
    gap: 1rem;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 100px;
}

.detail-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.parameters-list {
    display: grid;
    gap: 0.5rem;
}

.parameter-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.param-signature {
    margin-bottom: 0.25rem;
}

.param-description {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-style: italic;
}

.no-params {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .sidebar {
        width: 100%;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .content {
        overflow: visible;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        min-width: 100%;
    }

    .filters {
        width: 100%;
        justify-content: space-between;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.method-card {
    animation: fadeIn 0.3s ease;
}

/* ===== Highlight on search ===== */
.highlight {
    background: rgba(210, 153, 34, 0.3);
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}