/* App shell: sidebar, main content area, page scaffolding. */

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
}

/* Sidebar Navigation */
.sidebar {
    width: 200px;
    min-width: 200px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--sidebar-foreground);
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 8px;
}

.sidebar-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 12px 12px 4px;
    margin-top: 4px;
}

.sidebar-group-label:first-child {
    margin-top: 0;
    padding-top: 0;
}

/* "More": the secondary pages, collapsed by default. Styled as a group label
   that can be pressed, so the nav keeps one visual rhythm. */
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 10px;
    padding: 12px 12px 4px;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    cursor: pointer;
}
.sidebar-group-toggle:hover { color: var(--ink); }
.sidebar-group-toggle svg { transition: transform var(--transition); opacity: 0.7; }
.sidebar-group-toggle svg.is-open { transform: rotate(90deg); }
.sidebar-group-more { display: flex; flex-direction: column; gap: 2px; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
}

.sidebar-item:hover {
    color: var(--sidebar-foreground);
    background: var(--sidebar-hover);
}

.sidebar-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
    font-weight: 600;
}

.sidebar-item svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar-item.active svg {
    opacity: 1;
}

.sidebar-badge {
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius);
    margin-left: auto;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 8px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99;
    min-height: 44px;
}

.el-dropdown-menu__item.active {
    color: var(--el-color-primary);
    font-weight: 500;
    background-color: var(--el-color-primary-light-9);
}

.el-dropdown-menu__item.active::before {
    content: "✓ ";
}

.last-update {
    font-size: 13px;
    color: var(--text-muted);
}

/* Page Content */
.page-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* Settings Page - Full Width */
.page-content.settings-page {
    max-width: none;
    padding: 24px 32px;
}

/* Responsive: collapse sidebar */
@media (max-width: 768px) {
    .sidebar {
        width: 56px;
        min-width: 56px;
    }
    .sidebar-brand h1,
    .sidebar-item span,
    .sidebar-badge,
    .sidebar-footer .last-update {
        display: none;
    }
    .sidebar-item {
        justify-content: center;
        padding: 10px;
    }
}

.service-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
}

.service-icon.claude {
    background: linear-gradient(135deg, var(--text-secondary), var(--text-secondary));
}

.service-icon.codex {
    background: linear-gradient(135deg, var(--text-secondary), var(--text-secondary));
}

.service-icon.gemini {
    background: linear-gradient(135deg, var(--text-secondary), var(--text-tertiary));
}

.service-meta {
    display: flex;
    flex-direction: column;
}

.service-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.service-port {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: var(--green-fill);
    color: var(--green-ink);
}

.status-badge.offline {
    background: var(--secondary);
    color: var(--text-tertiary);
}

.card-metrics {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.metric-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* Client Section */
.client-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.section-header-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header-simple h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.section-count {
    font-size: 13px;
    color: var(--text-muted);
}

.client-table-simple table {
    width: 100%;
    border-collapse: collapse;
}

.client-table-simple th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.client-table-simple td {
    padding: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.client-table-simple tbody tr:last-child td {
    border-bottom: none;
}

.client-table-simple tbody tr:hover {
    background: var(--secondary);
}

.client-cell {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 13px;
}

.num-cell {
    text-align: right;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.error-cell {
    color: var(--red);
    font-weight: 500;
}

/* Legacy container support */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
