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

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161822;
    --bg-card: #1c1f2e;
    --bg-input: #131520;
    --border: #252836;
    --text-primary: #e4e6f0;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;
    --accent: #6c5ce7;
    --accent-hover: #7d6ff0;
    --red: #e94560;
    --red-hover: #ff6b81;
    --green: #2ed573;
    --green-bg: rgba(46, 213, 115, 0.1);
    --yellow: #ffa502;
    --orange: #ff6348;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============ APP LAYOUT ============ */
.app {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 32px;
    width: 48px;
    height: 48px;
    background: rgba(108, 92, 231, 0.15);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 12px;
    color: var(--accent);
    font-family: var(--mono);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: rgba(108, 92, 231, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(108, 92, 231, 0.15);
    color: #fff;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.badge {
    margin-left: auto;
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono);
}

.nav-item.active .badge {
    background: var(--accent);
    color: #fff;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(46, 213, 115, 0); }
}

/* ============ MAIN ============ */
.main {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
}

/* ============ TOP BAR ============ */
.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.breadcrumb {
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb .sep {
    margin: 0 8px;
    color: var(--border);
}

.breadcrumb span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
}

.search-box input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 36px 8px 14px;
    color: var(--text-primary);
    font-size: 13px;
    width: 220px;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--accent);
    width: 260px;
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

/* ============ BUTTONS ============ */
.btn {
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-download {
    background: rgba(108, 92, 231, 0.1);
    color: var(--accent);
    border: 1px solid rgba(108, 92, 231, 0.2);
    cursor: pointer;
}

.btn-download:hover {
    background: var(--accent);
    color: #fff;
}

/* ============ PAGE HEADER ============ */
.page-header {
    padding: 32px 24px 16px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============ STATS ROW ============ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 0 24px 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ REPO GRID ============ */
.repo-grid {
    display: grid;
    gap: 20px;
    padding: 0 24px 40px;
}

.repo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.repo-card-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.repo-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.repo-card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.repo-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--mono);
}

.repo-badge {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--green-bg);
    color: var(--green);
}

.repo-desc {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.repo-tags {
    padding: 0 20px 16px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    padding: 3px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.file-list {
    border-top: 1px solid var(--border);
}

.file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
}

.file-row:hover {
    background: rgba(255,255,255,0.02);
}

.file-row:last-child {
    border-bottom: none;
}

.file-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-family: var(--mono);
}

.file-icon {
    font-size: 16px;
}

.file-size, .file-date {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono);
    white-space: nowrap;
}

/* ============ PACKAGE TABLE ============ */
.package-table-container {
    padding: 0 24px 40px;
    overflow-x: auto;
}

.package-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.package-table thead {
    background: rgba(255,255,255,0.02);
}

.package-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.package-table td {
    padding: 14px 16px;
    font-size: 13px;
    border-top: 1px solid var(--border);
}

.pkg-name {
    font-family: var(--mono);
    color: var(--accent);
    font-weight: 500;
}

.ver-tag {
    background: rgba(108, 92, 231, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 12px;
}

/* ============ DOCS GRID ============ */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    padding: 0 24px 40px;
}

.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.2s;
}

.doc-card:hover {
    border-color: var(--accent);
}

.doc-icon {
    font-size: 36px;
}

.doc-card h3 {
    font-size: 16px;
    font-weight: 600;
}

.doc-card p {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

/* ============ API LIST ============ */
.api-list {
    padding: 0 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.api-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.api-method {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--mono);
    text-transform: uppercase;
    min-width: 50px;
    text-align: center;
}

.method-get {
    background: var(--green-bg);
    color: var(--green);
}

.method-post {
    background: rgba(255, 165, 2, 0.15);
    color: var(--yellow);
}

.api-info {
    flex: 1;
}

.api-info code {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--accent);
}

.api-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============ MONITOR ============ */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    padding: 0 24px 40px;
}

.monitor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.monitor-card h3 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meter {
    background: var(--bg-input);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.meter-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 1s;
}

.meter-value {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--mono);
}

.big-number {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--accent);
}

.monitor-stats {
    display: flex;
    gap: 16px;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    width: 400px;
    max-width: 90vw;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-icon {
    font-size: 40px;
    text-align: center;
    margin-bottom: 12px;
}

.modal h3 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 4px;
}

.modal-desc {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

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

.input-group {
    margin-bottom: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent);
}

.error-msg {
    color: var(--red);
    font-size: 13px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(233, 69, 96, 0.1);
    border-radius: var(--radius-sm);
    display: none;
    text-align: center;
}

.modal-footer {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.modal-footer a {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
}

.modal-footer a:hover {
    color: var(--accent);
}

.notice-box {
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    text-align: center;
}

.notice-error {
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.2);
    color: var(--red);
}

.notice-box code {
    display: block;
    margin-top: 8px;
    font-family: var(--mono);
    font-size: 13px;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============ TAB CONTENT ============ */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* ============ SHAKE ANIMATION ============ */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.shake {
    animation: shake 0.5s ease;
}
