:root {
    --bg-primary: #050510;
    --bg-secondary: #0f1020;

    /* Glass Colors */
    --glass-bg: rgba(20, 20, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);

    /* Brand Colors */
    --accent-indigo: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;

    --text-white: #ffffff;
    --text-gray: #94a3b8;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-white);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15), transparent 40%),
        radial-gradient(circle at 100% 0%, rgba(6, 182, 212, 0.15), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.1), transparent 40%);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
    /* Allow wrapping */
    gap: 1rem;
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.brand p {
    color: var(--text-gray);
    font-size: 1rem;
    margin-top: 0.25rem;
    font-weight: 300;
}

.status-barrier {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.status-barrier .status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-gray);
    box-shadow: 0 0 0 0 rgba(148, 163, 184, 0.2);
    transition: all 0.3s ease;
}

.status-barrier .status-dot.connected {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 15px var(--accent-emerald);
}

.status-barrier .status-text {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Control Bar */
.control-bar {
    display: flex;
    gap: 1rem;
    background: var(--glass-bg);
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.url-input-group {
    flex: 1;
    display: flex;
    gap: 1rem;
    min-width: 300px;
}

.url-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.url-input:focus {
    outline: none;
    border-color: var(--accent-indigo);
    background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
    background: var(--accent-indigo);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Grids */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    min-height: 400px;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .brand h1 {
        font-size: 2rem;
        white-space: normal;
    }
}

/* Cards */
/* Cards */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    /* overflow: hidden;  <-- REMOVED to allow tooltips to popup */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* New Clipper for background icons so they don't spill out */
.card-bg-clipper {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 1rem;
    pointer-events: none;
    z-index: 0;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-bg-icon {
    position: absolute;
    top: -20px;
    right: -20px;
    opacity: 0.05;
    transform: rotate(15deg);
    pointer-events: none;
    transition: transform 0.5s ease;
}

.card:hover .card-bg-icon {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.08;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    position: relative;
    /* Ensure z-index works */
    z-index: 2;
    /* Put above background */
}

/* ... existing icon-box ... */

.chart-container {
    height: 100%;
    min-height: 300px;
    position: relative;
    z-index: 2;
}

/* --- Tooltips --- */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    cursor: help;
    vertical-align: middle;
    z-index: 50;
    /* High priority */
}

.info-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.info-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: #fff;
}

.tooltip-content {
    visibility: hidden;
    width: 280px;
    /* Wider for more text */
    background-color: rgba(15, 23, 42, 0.98);
    color: #e2e8f0;
    text-align: left;
    border-radius: 8px;
    padding: 16px;
    /* More padding */
    position: absolute;
    z-index: 1000;
    /* Super high */
    bottom: 150%;
    /* Higher up */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-size: 0.85rem;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    font-weight: normal;
    text-transform: none;
    backdrop-filter: blur(8px);
}

.tooltip-wrapper:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0px);
}

/* Arrow */
.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.98) transparent transparent transparent;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-bg-icon {
    position: absolute;
    top: -20px;
    right: -20px;
    opacity: 0.05;
    transform: rotate(15deg);
    pointer-events: none;
    transition: transform 0.5s ease;
}

.card:hover .card-bg-icon {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.08;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    z-index: 1;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.card-title {
    font-family: var(--font-heading);
    color: var(--text-gray);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.card-value-container {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    z-index: 1;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.metric-unit {
    color: var(--text-gray);
    font-size: 1rem;
    font-weight: 500;
}

/* Specific Colors */
.accent-indigo {
    color: var(--accent-indigo);
}

.bg-indigo {
    background: rgba(99, 102, 241, 0.1);
}

.accent-cyan {
    color: var(--accent-cyan);
}

.bg-cyan {
    background: rgba(6, 182, 212, 0.1);
}

.accent-emerald {
    color: var(--accent-emerald);
}

.bg-emerald {
    background: rgba(16, 185, 129, 0.1);
}

.accent-amber {
    color: var(--accent-amber);
}

.bg-amber {
    background: rgba(245, 158, 11, 0.1);
}

/* Details List */
.details-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.detail-label {
    color: var(--text-gray);
    font-size: 0.95rem;
}

.detail-value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
}

.chart-container {
    height: 100%;
    min-height: 300px;
}

/* --- Tooltips --- */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    cursor: help;
    vertical-align: middle;
}

.info-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.info-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: #fff;
}

.tooltip-content {
    visibility: hidden;
    width: 220px;
    background-color: rgba(15, 23, 42, 0.98);
    color: #e2e8f0;
    text-align: left;
    border-radius: 8px;
    padding: 12px;
    position: absolute;
    z-index: 100;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    font-weight: normal;
    text-transform: none;
    backdrop-filter: blur(4px);
}

.tooltip-wrapper:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Arrow */
.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.98) transparent transparent transparent;
}