:root {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --rx-color: #0ea5e9;
    --tx-color: #8b5cf6;
    --font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-main));
    color: var(--text-main);
    min-height: 100vh;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navigation */
.top-nav {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
    border-top: none;
    border-left: none;
    border-right: none;
}

.nav-brand h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.nav-brand span {
    color: var(--accent);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin: 0;
}

.nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 600;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin: 0 auto;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.top-nav.glass-card {
    border-radius: 0;
    padding: 1rem 2rem;
}

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

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

/* Home Section Styles */
.hero-content {
    text-align: center;
    padding: 2rem 0;
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero-content .subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    text-align: left;
}

.feature-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.05);
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.feature-card p {
    color: var(--text-muted);
    line-height: 1.5;
}

/* Common UI Elements */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.status-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Network Section */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-box .label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-box .value {
    font-size: 2rem;
    font-weight: 700;
}

.rx-color { color: var(--rx-color); }
.tx-color { color: var(--tx-color); }

.chart-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.control-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.chart-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.filter-btn.active {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--rx-color);
    color: var(--rx-color);
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    margin-top: 2rem;
}

/* USB Section */
.usb-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.search-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 8px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
}

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

.speed-reference-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ref-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.ref-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ref-badge b {
    color: var(--text-main);
}

.usb-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 1600px) {
    .usb-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 1200px) {
    .usb-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .usb-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .usb-grid { grid-template-columns: 1fr; }
}

.speed-category {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fast-cat { color: #4ade80; }
.normal-cat { color: #60a5fa; }
.slow-cat { color: #f87171; }

.usb-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s, border-color 0.2s;
}

.usb-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.usb-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.usb-header i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.usb-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.usb-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.usb-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.detail-value {
    color: var(--text-main);
    font-weight: 500;
}

.speed-indicator {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.3);
}

.speed-indicator span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.speed-indicator.fast { border-left: 3px solid #4ade80; }
.speed-indicator.normal { border-left: 3px solid #60a5fa; }
.speed-indicator.slow { border-left: 3px solid #f87171; }

.speed-indicator strong {
    font-size: 1.15rem;
    font-weight: 700;
}

.speed-indicator.fast strong { color: #4ade80; }
.speed-indicator.normal strong { color: #60a5fa; }
.speed-indicator.slow strong { color: #f87171; }


.hidden {
    display: none !important;
}

.spinner {
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

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

/* Glances Section */
.iframe-container {
    width: 100%;
    height: 700px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}
