/* Font Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&family=Space+Grotesk:wght@700&display=swap');

:root {
    /* 🎨 Cyber-Luxe Palette */
    --color-bg: #050505;
    /* Void Black */
    --color-surface: rgba(20, 20, 20, 0.6);
    /* Glassmorphism Base */
    --color-primary: #CCFF00;
    /* Acid Green */
    --color-secondary: #7000FF;
    /* Electric Purple */
    --color-gold: #FFD700;
    /* Trophy Gold */
    --color-text-main: #F0F0F0;
    /* Ghost White */

    /* Mapped Variables */
    --color-text-primary: var(--color-text-main);
    --color-text-secondary: rgba(240, 240, 240, 0.7);
    --color-text-tertiary: rgba(240, 240, 240, 0.4);

    --color-border: rgba(255, 255, 255, 0.1);
    /* Subtle white border */

    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, #aaff00 100%);
    --gradient-glow: linear-gradient(135deg, rgba(204, 255, 0, 0.2) 0%, rgba(112, 0, 255, 0.2) 100%);

    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --shadow-neon: 0 0 10px rgba(204, 255, 0, 0.4);

    --radius-lg: 16px;
    --radius-md: 12px;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(112, 0, 255, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(204, 255, 0, 0.05) 0%, transparent 25%);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.insight-title,
.metric-name {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value,
.metric-value,
.chart-date-label,
#chart-y-axis span {
    font-family: var(--font-mono);
}

html {
    scroll-behavior: smooth;
}

.bg-gradient {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.bg-shapes {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--gradient-primary);
    top: -10%;
    left: -10%;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    bottom: -10%;
    right: -10%;
    animation-delay: -7s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.header {
    position: sticky;
    top: 0;
    background: rgba(15, 15, 30, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-xl);
    /* Added spacing after header */
}

/* Ensure logo image fits well */
.logo img {
    height: 80px;
    /* Increased size as requested */
    width: auto;
    object-fit: contain;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-hover);
}

.nav-link.active {
    color: var(--color-primary);
}

.main {
    min-height: calc(100vh - 200px);
    padding: var(--spacing-2xl) 0;
}

.hero {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInUp 0.6s ease-out;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    /* Centered */
    margin-bottom: var(--spacing-xl);
    position: relative;
    z-index: 10;
}

.search-box {
    display: flex;
    align-items: center;
    /* Vertical Center */
    gap: var(--spacing-sm);
    background: var(--color-surface);
    padding: 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-neon);
}

.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 12px;
    color: var(--color-text-tertiary);
}

input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 1rem;
    font-family: var(--font-body);
    outline: none;
    padding: 8px 0;
}

input[type="text"]::placeholder {
    color: var(--color-text-tertiary);
}

.search-btn {
    background-color: var(--color-primary);
    color: #000000;
    /* Black text on Acid Green */
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--color-primary);
}

/* Loading State */
.loading-container {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loader-logo {
    width: 80px;
    /* Adjust size as needed */
    height: auto;
    margin-bottom: 20px;
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(204, 255, 0, 0.2));
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px rgba(204, 255, 0, 0.6));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(204, 255, 0, 0.2));
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.loading-text {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
}

.results-section {
    animation: fadeInUp 0.6s ease-out;
}

.results-section.hidden {
    display: none;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

/* Search Hint */
.search-hint {
    margin-top: 16px;
    /* Space between search box and text */
    font-size: 0.9rem;
    color: var(--color-text-tertiary);
    text-align: center;
}

.profile-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

/* Subtle Pulse Ring */
.profile-avatar::after {
    content: '';
    position: absolute;
    inset: -6px;
    /* Gap from image */
    border-radius: 50%;
    border: 1px solid var(--color-primary);
    /* Thin border */
    box-shadow: 0 0 10px rgba(204, 255, 0, 0.2);
    /* Subtle glow */
    animation: pulse-subtle 3s infinite ease-in-out;
    pointer-events: none;
    z-index: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    box-shadow: none;
    display: block;
    position: relative;
    /* Above ring */
    z-index: 1;
}

@keyframes pulse-subtle {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.profile-username {
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.profile-bio {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.follow-btn {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: all var(--transition-base);
}

.follow-btn:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    transform: translateY(-2px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-md);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-followers {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(102, 126, 234, 0.05));
    color: var(--color-primary);
}

.stat-icon-following {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.2), rgba(240, 147, 251, 0.05));
    color: var(--color-accent);
}

.stat-icon-posts {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
    color: var(--color-success);
}

.stat-icon-engagement {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
    color: var(--color-warning);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
    display: block;
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    margin-bottom: var(--spacing-xs);
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.stat-change.positive {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.stat-change.neutral {
    background: var(--color-surface);
    color: var(--color-text-tertiary);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-md);
}

.insight-card {
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
}

.insight-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-md);
}

.insight-card.full-width {
    grid-column: 1 / -1;
}

.insight-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

/* Profile Header */
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

/* Legacy duplicated styles removed - see bottom of file for active styles */

.profile-info h2 {
    font-size: 2rem;
    margin-bottom: 4px;
    color: var(--color-text-main);
}

.profile-username {
    font-family: var(--font-mono);
    color: var(--color-primary);
    font-size: 1rem;
    margin-bottom: 12px;
    display: inline-block;
}

.profile-bio {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    max-width: 600px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    /* Sharper */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    /* Subtle */
}

.stat-icon svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
    /* Acid Green Icons */
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--color-surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--color-text-main);
}

.stat-change {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--color-primary);
}

/* Green */
.stat-change.negative {
    color: #ff3366;
}

/* Red still okay ? or use purple? Keeping red for negative */

/* Keyword/Hashtag Badges */
.keyword-badge {
    background: rgba(112, 0, 255, 0.15);
    color: var(--color-secondary);
    border: 1px solid rgba(112, 0, 255, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* ... content showcase ... */
.insta-btn {
    background: var(--color-primary);
    color: #000;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 4px;
    text-transform: uppercase;
    font-family: var(--font-heading);
    transition: 0.2s;
}

.insta-btn:hover {
    box-shadow: 0 0 10px var(--color-primary);
}

.demographics {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.demo-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.demo-label {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
    font-weight: 600;
}

.demo-bar {
    height: 8px;
    background: var(--color-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.demo-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 500ms;
}

.demo-value {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.gender-split {
    display: flex;
    gap: var(--spacing-md);
}

.gender-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: 600;
}

.gender-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.gender-icon.male {
    background: rgba(102, 126, 234, 0.2);
    color: var(--color-primary);
}

.gender-icon.female {
    background: rgba(240, 147, 251, 0.2);
    color: var(--color-accent);
}

.location-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.location-list li {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.metrics-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-name {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
    font-weight: 600;
}

.metric-value {
    font-size: 1.125rem;
    font-weight: 700;
}

.metric-bar {
    height: 6px;
    background: var(--color-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 500ms;
}

.chart-container {
    margin-top: var(--spacing-md);
}

.chart-placeholder {
    margin-bottom: var(--spacing-sm);
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
}

.footer {
    background: var(--color-bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-2xl);
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer p {
    color: var(--color-text-tertiary);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: var(--spacing-md);
}

.footer-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-base);
}

.footer-link:hover {
    color: var(--color-primary);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .header .container {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .nav {
        gap: var(--spacing-sm);
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .stats-grid,
    .insights-grid {
        grid-template-columns: 1fr;
    }

    .footer .container {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }

    .search-box {
        flex-direction: column;
        align-items: stretch;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* --- DEEP INSIGHTS: CHARTS & TOOLTIPS --- */

/* Tooltip System */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-tertiary);
    font-size: 10px;
    font-weight: bold;
    margin-left: 6px;
    cursor: help;
    transition: all 0.2s;
    position: relative;
}

.info-icon:hover {
    background: var(--color-primary);
    color: white;
}

/* Tooltip Body */
.tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: var(--color-bg-secondary);
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    /* Position above */
    left: 50%;
    margin-left: -110px;
    /* Center */
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    pointer-events: none;
}

.info-icon:hover .tooltip-text,
.info-icon.active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Chart Axes */
.chart-wrapper {
    display: flex;
    height: 240px;
    position: relative;
    padding-bottom: 30px;
    /* Space for X-Axis */
    padding-left: 40px;
    /* Space for Y-Axis */
}

.y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 30px;
    width: 35px;
    color: var(--color-text-tertiary);
    font-size: 10px;
    text-align: right;
    padding-right: 5px;
}

.chart-area {
    display: flex;
    align-items: flex-end;
    flex: 1;
    height: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    gap: 6px;
    /* Fixed gap */
    overflow-x: auto;
    /* Enable Scroll */
    padding-right: 10px;

    /* Scrollbar Styling - Subtle */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.chart-area::-webkit-scrollbar {
    height: 4px;
    /* Thinner */
}

.chart-area::-webkit-scrollbar-track {
    background: transparent;
}

.chart-area::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.chart-area::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-primary);
    /* Acid Green only on hover */
}

.bar-hover-area {
    min-width: 20px;
    /* Force scroll if too many */
    flex-shrink: 0;
    /* Prevent shrinking below min-width */
}

/* Gridlines */
.grid-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    width: 100%;
}

/* --- REFINEMENTS: FILTERS & CHART --- */

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-group {
    display: flex;
    background: var(--color-bg-primary);
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.filter-btn:hover {
    color: var(--color-text-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    color: #000;
    /* Black text on Acid Green */
    box-shadow: var(--shadow-neon);
}

/* Engagement Toggles (Small text links) */
.toggle-links {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.7rem;
}

.toggle-link {
    color: var(--color-text-tertiary);
    cursor: pointer;
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}

.toggle-link:hover,
.toggle-link.active {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Dropdown Styles */
.dropdown-trigger {
    font-size: 0.75rem;
    color: var(--color-primary);
    cursor: pointer;
    margin-top: 4px;
    list-style: none;
    /* Hide default triangle in some browsers */
    font-weight: 500;
    font-family: var(--font-mono);
}

.dropdown-trigger::-webkit-details-marker {
    display: none;
}

.breakdown-list {
    margin-top: 8px;
    padding-left: 10px;
    border-left: 2px solid var(--color-primary);
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

/* --- FIXES 1: CENTER ALIGNMENT & SPACING --- */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    /* Centered */
    margin-bottom: 60px;
    /* Increased Spacing */
    position: relative;
    z-index: 10;
}

.search-box {
    display: flex;
    align-items: center;
    /* Vertical Center */
    gap: var(--spacing-sm);
    /* ... existing styles ... */
    background: var(--color-surface);
    padding: 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.search-icon,
.info-icon,
.search-btn {
    display: flex;
    align-items: center;
    /* Vertical Center */
    justify-content: center;
}

/* --- FIXES 2: PROFILE BORDER --- */
/* Approach: Clean, no border */
.profile-img-container {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 50%;
    /* Ensure container is round if needed */
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0;
    border: none;
    box-shadow: none;
    /* Completely removed */
}

/* --- FIXES 3: CHART LABELS --- */
.chart-date-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-top: 12px;
    /* Push below axis line */
    transform: none;
    /* STRAIGHT */
    white-space: nowrap;
    font-family: var(--font-mono);
    text-align: center;
}

/* --- FIXES 4: TOOLTIP ALIGNMENT --- */
.insight-title {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Space between text and ? */
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.info-icon {
    margin-left: 0;
    /* Handled by gap */
}

/* White Chart Tooltip */
.chart-tooltip-popup {
    position: absolute;
    background: white;
    color: #1a1a2e;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 9999;
    /* Ensure on top */
    opacity: 0;
    transition: opacity 0.2s;
    min-width: 140px;
    /* Positioning now handled by JS for global tooltip */
    width: max-content;
    /* Ensure width expands */
    max-width: 250px;
    /* Cap width */
}

.chart-tooltip-popup strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: #000;
}

.bar-hover-area:hover .chart-tooltip-popup {
    opacity: 1;
}

/* Comparison Bars (Image vs Video) */
.comparison-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    /* Prevent wrapping */
}

.comp-label {
    width: 110px;
    /* Increased from 60px to fix overlap */
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    min-width: 80px;
    /* Fixed width */
}

/* New Badges & Indicators */
.private-tag {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-text-tertiary);
    margin-left: 6px;
    vertical-align: middle;
}

.keyword-badge {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    color: #e0e7ff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid rgba(102, 126, 234, 0.3);
    display: inline-block;
}

.strategy-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.comp-track {
    flex: 1;
    height: 8px;
    background: var(--color-surface);
    border-radius: 4px;
    overflow: hidden;
    flex-grow: 1;
    /* Take remaining space */
    min-width: 50px;
    /* Prevent collapse */
}

.comp-fill {
    height: 100%;
    border-radius: 4px;
}

.fill-image {
    background: linear-gradient(90deg, #ff8a00, #e52e71);
}

.fill-video {
    background: linear-gradient(90deg, #11998e, #38ef7d);
}

.fill-album {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.comp-val {
    width: 40px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: bold;
}

.fill-video {
    background: #f093fb;
}

.fill-image {
    background: #667eea;
}

/* --- CONTENT SHOWCASE SECTIONS --- */

.showcase-section {
    grid-column: 1 / -1;
    /* Full width */
    margin-top: var(--spacing-md);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.media-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.media-card:hover {
    transform: scale(1.02);
    border-color: var(--color-primary);
}

.media-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 30, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 10px;
    text-align: center;
}

.media-card:hover .media-overlay {
    opacity: 1;
}

.media-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.media-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.insta-btn {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}

.media-card:hover .insta-btn {
    opacity: 1;
    transform: translateY(0);
}

.insta-btn:hover {
    filter: brightness(1.1);
}

.video-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    pointer-events: none;
}

.empty-message {
    color: var(--color-text-tertiary);
    font-size: 0.9rem;
    font-style: italic;
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

@media (min-width: 1024px) {
    .content-grid {
        grid-template-columns: repeat(6, 1fr);
        /* Force 6 cols on desktop */
    }
}

/* --- MOBILE RESPONSIVENESS --- */
/* Menu Toggle Button (Default Hidden) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

@media (max-width: 768px) {

    /* Prevent Horizontal Overflow Global */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    .container {
        padding: 0 15px;
        /* Comfortable mobile padding */
        width: 100%;
        overflow-x: hidden;
        /* Clip anything spilling out */
    }

    /* Header Layout */
    .header .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        position: relative;
        overflow-x: visible;
    }

    .menu-toggle {
        display: block;
        /* FIX: Restored visibility */
    }

    .nav {
        display: none;
        width: 100vw;
        margin-left: -15px;
        flex-direction: column;
        gap: var(--spacing-sm);
        padding-top: var(--spacing-md);
        text-align: center;
        background: rgba(15, 15, 30, 0.98);
        position: absolute;
        top: 100%;
        left: 0;
        padding-bottom: 20px;
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1000;
        box-sizing: border-box;
    }

    /* ... (nav.active kept via original file context if not replaced here, but I must match block) */
    .nav.active {
        display: flex;
    }

    .hero-title {
        font-size: 1.8rem;
        margin-top: 10px;
        word-wrap: break-word;
    }

    /* Compact Search Bar - Force Single Row */
    .search-container {
        margin-bottom: 20px;
        padding: 0;
        width: 100%;
    }

    .search-box {
        display: flex;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        padding: 4px;
        /* Minimal container padding */
        gap: 0;
        /* No gap for strict 75/25 calculation */
        width: 100%;
    }

    .search-icon {
        display: none;
        /* Hide icon to make room for 75/25 split */
    }

    input[type="text"] {
        font-size: 0.9rem;
        flex: 0 0 75%;
        width: 75%;
        min-width: 0;
        padding-left: 8px;
        /* Text spacing */
    }

    /* Compact Analyze Button */
    .search-btn {
        flex: 0 0 25%;
        width: 25%;
        padding: 0;
        height: 36px;
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        justify-content: center;
        line-height: 1;
        display: flex;
        align-items: center;
        border-radius: var(--radius-md);
        /* Match website style */
    }

    .search-btn svg {
        display: none;
    }

    /* Prevent Grid Overflow */
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        /* Smaller min-width for mobile */
        gap: 8px;
        /* Tighter gap */
    }

    .media-stats {
        font-size: 0.75rem;
        /* Smaller text for smaller cards */
    }

    /* Hide specific text if really needed for space, but user didn't ask */

    .search-hint {
        font-size: 0.75rem;
    }

    /* Compact Profile Header (Grid Layout) */
    .profile-header {
        display: grid;
        grid-template-columns: 60px 1fr;
        /* Avatar | Info */
        grid-template-rows: auto auto auto auto auto;
        grid-template-areas:
            "avatar name"
            "avatar username"
            "bio bio"
            "readmore readmore"
            "follow follow";
        column-gap: 15px;
        row-gap: 4px;
        /* Tighter vertical spacing */
        padding: 15px;
        align-items: center;
    }

    .profile-avatar {
        grid-area: avatar;
        width: 60px;
        height: 60px;
        align-self: center;
        /* Center vertically relative to name/user rows */
    }

    /* UNWRAP wrapper so children hit the grid */
    .profile-info {
        display: contents;
    }

    .profile-name {
        grid-area: name;
        font-size: 1.1rem;
        margin: 0;
        line-height: 1.2;
        text-align: left;
        justify-self: start;
        align-self: end;
    }

    .profile-username {
        grid-area: username;
        font-size: 0.9rem;
        margin: 0;
        color: var(--color-primary);
        text-align: left;
        justify-self: start;
        align-self: start;
    }

    .profile-bio {
        grid-area: bio;
        font-size: 0.85rem;
        line-height: 1.4;
        margin-top: 5px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        /* Limit to 3 lines */
        -webkit-box-orient: vertical;
        overflow: hidden;
        opacity: 0.9;
        white-space: pre-line;
        /* Respect newlines */
    }

    .profile-bio.expanded {
        -webkit-line-clamp: unset;
        /* Show full */
        display: block;
    }

    .read-more-btn {
        grid-area: readmore;
        background: none;
        border: none;
        color: var(--color-text-tertiary);
        font-size: 0.75rem;
        padding: 0;
        cursor: pointer;
        justify-self: start;
        margin-top: -4px;
    }

    .read-more-btn:hover {
        color: var(--color-primary);
        text-decoration: underline;
    }

    .read-more-btn.hidden {
        display: none;
    }

    .follow-btn {
        grid-area: follow;
        width: 100%;
        /* Full width under bio */
        padding: 8px;
        font-size: 0.9rem;
        margin-top: 5px;
        justify-content: center;
    }

    /* --- OVERFLOW FIXES & SECTION CONTROLS --- */

    /* 1. Ensure all cards fit within container */
    .insight-card,
    .stat-card,
    .strategy-box,
    .metrics-list {
        max-width: 100%;
        overflow-wrap: break-word;
        /* Prevent text blowout */
        box-sizing: border-box;
    }

    /* 2. Allow Titles to Wrap */
    .insight-title,
    .metric-name,
    h1,
    h2,
    h3,
    h4 {
        white-space: normal;
        /* Force wrap */
        line-height: 1.3;
    }

    /* 3. Posting Habits (Demographics) */
    .demographics {
        flex-direction: column;
        /* Stack items */
        width: 100%;
    }

    .demo-item {
        width: 100%;
    }

    /* 4. Chart & Histograms - MOBILE FIXES */
    .chart-area {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 15px;
        /* More scroll space */
        display: flex;
        justify-content: flex-start;
        /* Force left alignment (scroll start) */
    }

    /* Force wider scrollable bars on mobile */
    .bar-hover-area {
        min-width: 35px !important;
        /* Force wider bars */
        flex-shrink: 0;
    }

    /* 5. Grids */
    .content-grid {
        /* Ensure columns don't force width > screen */
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        /* Slightly larger min for visibility, but allow wrap */
        gap: 8px;
        width: 100%;
        margin-right: 0;
    }

    /* On very small screens, drop to 2 columns specifically */
    @media (max-width: 350px) {
        .content-grid {
            grid-template-columns: 1fr 1fr;
        }
    }

    .media-card {
        width: 100%;
        /* Fill grid cell */
    }

    /* 6. Comparison Bars (Content Mix) */
    .comp-row {
        flex-wrap: wrap;
        /* Allow wrapping if needed */
        gap: 5px;
    }

    .comp-label {
        width: 100px;
        /* Limit label width */
    }

    /* 7. Engagement Dropdowns */
    .breakdown-item {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }

    /* Fix Insight Cards being too wide */
    .insight-card.full-width {
        width: 100%;
        overflow: hidden;
        /* Or auto if inner content scrolls */
    }

    /* 8. Search Bar Visibility Fix (Not sticky) */
    .search-container {
        position: relative;
        z-index: 101;
        /* High priority to prevent clicking blocked */
        margin-bottom: 20px;
        width: 100%;
        /* No background or sticky behavior as requested */
    }

    .profile-stats {
        justify-content: flex-start;
        gap: 15px;
        margin-top: 10px;
        /* Add space if stats follow header in flow */
    }

    /* Grid Adjustments */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Force 2 columns */
        gap: 10px;
    }

    /* Compact Stat Cards for Mobile */
    .stats-grid .stat-card {
        padding: 12px;
        flex-direction: column;
        /* Stack icon and text inside card if needed, or keep row but tighter */
        gap: 8px;
    }

    .stats-grid .stat-value {
        font-size: 1.4rem;
        /* Smaller font */
    }

    .stats-grid .stat-icon {
        width: 40px;
        height: 40px;
    }

    .insights-grid {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 15px;
    }

    .insight-card {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Chart scroll fix */
    .chart-area {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
        /* Space for scrollbar */
    }
}