/* ============================================================
   JSON Stats Analyzer — Styles (Indigo)
   ============================================================ */

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

:root {
    --bg-primary: #0B0D18;
    --bg-secondary: #111428;
    --bg-tertiary: #1A1D36;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.3);
    --text-primary: #ECEDF6;
    --text-secondary: #A0A4C4;
    --text-muted: #636788;
    --primary: #6366F1;
    --primary-hover: #818CF8;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --green: #34D399;
    --yellow: #FACC15;
    --red: #F43F5E;
    --blue: #3B82F6;
    --purple: #A855F7;
    --orange: #F59E0B;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xl: 20px;
    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 20% 15%, rgba(99, 102, 241, 0.06) 0%, transparent 55%), radial-gradient(ellipse at 80% 80%, rgba(129, 140, 248, 0.04) 0%, transparent 55%);
    pointer-events: none;
}

.app {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 48px;
}

.header {
    padding: 28px 0 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.45rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.main {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
}

.right-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 22px;
    backdrop-filter: blur(16px);
}

.panel-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Input */
textarea {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.5;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition);
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-primary {
    flex: 1;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
}

.parse-status {
    margin-top: 8px;
    font-size: 0.75rem;
    font-family: var(--mono);
    min-height: 20px;
}

.parse-status.ok {
    color: var(--green);
}

.parse-status.err {
    color: var(--red);
}

/* Overview */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.overview-card {
    text-align: center;
    padding: 14px 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.ov-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--text-primary);
}

.ov-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Type bars */
.type-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.type-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.type-label {
    min-width: 60px;
    font-size: 0.75rem;
    font-family: var(--mono);
    color: var(--text-secondary);
    text-align: right;
}

.type-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: 5px;
    overflow: hidden;
}

.type-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.type-count {
    min-width: 30px;
    font-size: 0.72rem;
    font-family: var(--mono);
    color: var(--text-muted);
}

/* Size list */
.size-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.size-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-glass);
    border-radius: 6px;
    font-size: 0.75rem;
}

.size-key {
    font-family: var(--mono);
    color: var(--primary-hover);
}

.size-val {
    font-family: var(--mono);
    color: var(--text-muted);
}

/* Array stats */
.array-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.arr-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.arr-label {
    color: var(--text-secondary);
}

.arr-val {
    font-family: var(--mono);
    color: var(--text-primary);
}

/* Dup list */
.dup-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dup-item {
    padding: 6px 10px;
    background: rgba(244, 63, 94, 0.08);
    border-left: 2px solid var(--red);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--mono);
    color: var(--red);
}

.dup-item .dup-count {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.no-dups {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 8px 0;
}

/* Export */
.btn-export {
    padding: 10px 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
}

.btn-export:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: 0 4px 24px var(--primary-glow);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

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

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

    .bottom-row {
        grid-template-columns: 1fr;
    }
}