/* ── NPM Package Size Analyzer ── */
/* Theme: NPM Red Dark Mode */

:root {
    --primary: #CC3534;
    --primary-light: #E84C4C;
    --secondary: #C12127;
    --accent: #2ECC71;
    --bg: #0D1117;
    --bg-card: #161B22;
    --bg-elevated: #1C2128;
    --text: #E6EDF3;
    --text-secondary: #8B949E;
    --border: #30363D;
    --radius: 10px;
    --font: 'Inter', sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

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

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

.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
    padding: 40px 0 20px;
    text-align: center;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-accent {
    color: var(--primary);
}

.tagline {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 1.05rem;
}

/* ── Search ──────────────────────────────────────────────── */
.search-section {
    padding: 20px 0 30px;
}

.search-container {
    position: relative;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    margin-left: 16px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    padding: 14px 16px;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    padding: 14px 28px;
    background: var(--primary);
    color: white;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font);
}

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

.compare-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 12px;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.suggestions.visible {
    display: block;
}

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    transition: background 0.15s;
    font-size: 0.9rem;
}

.suggestion-item:hover {
    background: var(--bg-card);
}

.suggestion-item .pkg-name {
    font-weight: 600;
}

.suggestion-item .pkg-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ── Results ─────────────────────────────────────────────── */
.results {
    padding-bottom: 30px;
}

.package-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pkg-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.pkg-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.pkg-version {
    font-family: var(--mono);
    color: var(--primary);
    font-size: 0.9rem;
    margin-left: 8px;
}

.pkg-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
    max-width: 600px;
}

.pkg-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--mono);
}

.badge-green {
    background: rgba(46, 204, 113, 0.15);
    color: var(--accent);
}

.badge-yellow {
    background: rgba(241, 196, 15, 0.15);
    color: #F1C40F;
}

.badge-red {
    background: rgba(204, 53, 52, 0.15);
    color: var(--primary-light);
}

/* Size Stats */
.size-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

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

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--mono);
    margin-top: 4px;
}

.stat-value.accent {
    color: var(--accent);
}

.stat-value.primary {
    color: var(--primary);
}

.stat-value.warn {
    color: #F1C40F;
}

/* Size Bars */
.size-bars {
    margin-bottom: 24px;
}

.size-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.size-bar-label {
    width: 80px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
}

.size-bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.size-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.75rem;
    font-family: var(--mono);
    font-weight: 600;
    color: white;
}

.size-bar-fill.raw {
    background: linear-gradient(135deg, #E74C3C, var(--primary));
}

.size-bar-fill.min {
    background: linear-gradient(135deg, #F1C40F, #E67E22);
}

.size-bar-fill.gz {
    background: linear-gradient(135deg, var(--accent), #1ABC9C);
}

/* Load Time */
.load-time {
    margin-bottom: 24px;
}

.load-time h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.load-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.load-card {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.load-network {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.load-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--mono);
}

/* Dependency Tree */
.dep-tree {
    margin-bottom: 24px;
}

.dep-tree h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.dep-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dep-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-family: var(--mono);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dep-size {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* Alternatives */
.alternatives {
    margin-bottom: 16px;
}

.alternatives h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.alt-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.alt-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.alt-item:hover {
    border-color: var(--accent);
}

.alt-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.alt-size {
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.85rem;
    margin-top: 2px;
}

.alt-savings {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* ── Comparison ──────────────────────────────────────────── */
.comparison {
    padding-bottom: 40px;
}

.comparison h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
}

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

.comparison-table th {
    background: var(--bg-elevated);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.comparison-table td {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.85rem;
}

.comparison-table tr:hover td {
    background: rgba(204, 53, 52, 0.05);
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

.hidden {
    display: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .logo {
        font-size: 1.5rem;
    }

    .size-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .load-grid {
        grid-template-columns: 1fr;
    }

    .pkg-header {
        flex-direction: column;
    }
}