:root {
    /* Amber Gold Palette */
    --primary: #F39C12;
    /* Amber Gold */
    --secondary: #FFEAA7;
    /* Soft Light Gold */
    --accent: #00CEC9;
    /* Neon Cyan */

    --bg-dark: #1A150A;
    /* Deep Warm Dark */
    --bg-panel: rgba(38, 30, 16, 0.7);
    --bg-input: rgba(0, 0, 0, 0.4);

    --border-light: rgba(243, 156, 18, 0.15);
    --border-focus: rgba(0, 206, 201, 0.6);

    --text-primary: #F8FAFC;
    --text-muted: #A39683;

    --radius: 12px;
    --transition: 0.25s ease;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(243, 156, 18, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 206, 201, 0.05) 0%, transparent 40%);
}

.code-font {
    font-family: 'JetBrains Mono', monospace;
}

.text-secondary {
    color: var(--secondary);
    opacity: 0.9;
}

.text-muted {
    color: var(--text-muted);
}

/* Utilities */
.hidden {
    display: none !important;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-row {
    display: flex;
    align-items: center;
}

.flex-1 {
    flex: 1;
    min-height: 0;
}

.gap-m {
    gap: 1rem;
}

.gap-s {
    gap: 0.5rem;
}

.mt-m {
    margin-top: 1rem;
}

.mt-l {
    margin-top: 1.5rem;
}

.p-m {
    padding: 1.25rem;
}

.border-b {
    border-bottom: 1px solid var(--border-light);
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* App Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
}

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

.brand-icon {
    color: var(--primary);
}

.app-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.badge {
    background: rgba(243, 156, 18, 0.15);
    color: var(--primary);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge.secondary {
    background: rgba(0, 206, 201, 0.15);
    color: var(--accent);
}

.badge.outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
}

.header-info {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* Upload View */
.upload-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-zone {
    width: 100%;
    max-width: 600px;
    border: 2px dashed rgba(243, 156, 18, 0.3);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    text-align: center;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.2);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(243, 156, 18, 0.05);
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-zone h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.upload-zone p {
    color: var(--text-muted);
}

.error-msg {
    color: #ff7675;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(214, 48, 49, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(214, 48, 49, 0.3);
    font-size: 0.9rem;
}

.btn {
    padding: 0.7rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition);
}

.primary-btn {
    background: var(--primary);
    color: #111;
}

.primary-btn:hover {
    background: var(--secondary);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

/* Analysis View */
.analysis-view {
    flex: 1;
    display: flex;
    gap: 1.5rem;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    width: 320px;
    flex-shrink: 0;
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Build Breakdown Chart */
.breakdown-chart {
    display: flex;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-input);
    margin-bottom: 1rem;
}

.bd-seg {
    height: 100%;
    transition: width 0.3s ease;
}

.breakdown-legend {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 150px;
    overflow-y: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
}

.swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-right {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

/* Section List */
.section-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.section-item {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.section-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.section-item.active {
    background: rgba(243, 156, 18, 0.1);
    border-left: 3px solid var(--primary);
}

.s-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

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

/* Inspector */
.inspector {
    flex: 1;
    min-width: 0;
}

.inspector-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inspector-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.inspector-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

.stat-lbl {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-val {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary);
}

/* Inspector Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    background: rgba(0, 0, 0, 0.2);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.type-cell {
    color: var(--accent);
}

.name-cell {
    color: var(--secondary);
    font-weight: 500;
}

/* Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(243, 156, 18, 0.2);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(243, 156, 18, 0.4);
}

@media (max-width: 900px) {
    .analysis-view {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-shrink: initial;
    }

    .section-list {
        max-height: 200px;
    }
}