/* ========== CSS Variables (shadcn-inspired) ========== */
:root {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #0a0a0c;
    --card-foreground: #fafafa;
    --popover: #09090b;
    --popover-foreground: #fafafa;
    --primary: #fafafa;
    --primary-foreground: #18181b;
    --secondary: #27272a;
    --secondary-foreground: #fafafa;
    --muted: #27272a;
    --muted-foreground: #a1a1aa;
    --accent: #27272a;
    --accent-foreground: #fafafa;
    --destructive: #7f1d1d;
    --destructive-foreground: #fafafa;
    --border: #27272a;
    --input: #27272a;
    --ring: #d4d4d8;
    --success: #22c55e;
    --warning: #eab308;
    --info: #3b82f6;
    --radius: 0.5rem;
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== Layout ========== */
.container { max-width: 1600px; margin: 0 auto; padding: 0 2rem; }

/* ========== Header ========== */
header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    background: var(--background);
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

nav { display: flex; gap: 0.5rem; }

nav a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: var(--muted-foreground);
    font-size: 0.875rem;
    transition: all 0.2s;
}

nav a:hover, nav a.active {
    background: var(--secondary);
    color: var(--foreground);
    text-decoration: none;
}

.network-badge {
    background: var(--secondary);
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== Network Selector ========== */
.network-selector-container {
    padding: 1rem 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.network-selector {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.network-btn {
    padding: 0.625rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 2rem;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.network-btn:hover {
    border-color: var(--info);
    color: var(--foreground);
}

.network-btn.active {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-color: transparent;
    color: white;
}

.network-btn.l2 .l2-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--success);
    color: var(--background);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 0.5rem;
    font-weight: bold;
}

/* ========== Search ========== */
.search-container {
    padding: 1.5rem 0;
    background: linear-gradient(180deg, var(--card) 0%, var(--background) 100%);
    border-bottom: 1px solid var(--border);
}

.search-box {
    display: flex;
    max-width: 800px;
    margin: 0 auto;
}

.search-box input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--input);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--foreground);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--ring);
}

.search-box input::placeholder { color: var(--muted-foreground); }

.search-box button {
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.search-box button:hover { opacity: 0.9; }

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.5rem 0;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.stat-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--foreground);
}

.stat-card .sub {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
}

/* ========== Cards & Tables ========== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-content { padding: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--secondary);
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover { background: var(--secondary); }

.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
}

.truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== Badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-warning { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-muted { background: var(--secondary); color: var(--muted-foreground); }

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.pagination button {
    padding: 0.5rem 0.875rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--ring);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination span {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* ========== Detail Page ========== */
.detail-page { padding: 2rem 0; }

.detail-header {
    margin-bottom: 1.5rem;
}

.detail-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detail-grid {
    display: grid;
    gap: 0.75rem;
}

.detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    padding: 0.875rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 1rem;
}

.detail-label {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.detail-value {
    font-size: 0.875rem;
    word-break: break-all;
}

/* ========== Main Content ========== */
main { padding: 1.5rem 0 3rem; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* ========== Footer ========== */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* ========== Loading ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--muted-foreground);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Responsive ========== */
@media (max-width: 1200px) {
    .container { padding: 0 1.5rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    .header-content { flex-direction: column; align-items: flex-start; }
    nav { width: 100%; overflow-x: auto; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .detail-row { grid-template-columns: 1fr; }
    th, td { padding: 0.5rem; }
    .hide-mobile { display: none; }
}

/* ========== View Containers ========== */
.view { display: none; }
.view.active { display: block; }
