:root {
    --primary: #8B5CF6;
    --primary-dim: rgba(139, 92, 246, 0.12);
    --secondary: #A78BFA;
    --accent: #C4B5FD;
    --critical: #EF4444;
    --critical-dim: rgba(239, 68, 68, 0.12);
    --warning: #F59E0B;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --info: #3B82F6;
    --info-dim: rgba(59, 130, 246, 0.12);
    --success: #10B981;
    --bg: #0F0B1A;
    --bg-card: rgba(18, 14, 28, 0.85);
    --bg-elevated: #1A1528;
    --bg-input: #0D0916;
    --text: #E8E0FF;
    --text-sec: #9B8EC4;
    --text-muted: #5B4F7A;
    --border: rgba(155, 142, 196, 0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, 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;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 11, 26, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

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

.logo-icon {
    font-size: 1.25rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-dim);
    border-radius: var(--radius-sm);
}

.app-title {
    font-size: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 0.625rem;
    color: var(--text-sec);
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-sec);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
}

.lang-select {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.6875rem;
    outline: none;
}

/* Editor Layout */
.editor-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 340px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    width: 100%;
    gap: 10px;
}

.code-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-sec);
    border-bottom: 1px solid var(--border);
}

.line-info {
    font-size: 0.5625rem;
    color: var(--text-muted);
}

.code-editor-wrapper {
    display: flex;
    flex: 1;
    min-height: 400px;
}

.line-numbers {
    padding: 12px 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.6875rem;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    min-width: 36px;
    overflow: hidden;
}

.code-textarea {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.6875rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    overflow-y: auto;
    tab-size: 2;
}

.results-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-sec);
    border-bottom: 1px solid var(--border);
}

.score-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.625rem;
    font-weight: 800;
}

.score-good {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.score-warn {
    background: var(--warning-dim);
    color: var(--warning);
}

.score-bad {
    background: var(--critical-dim);
    color: var(--critical);
}

.severity-bar {
    display: flex;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}

.sev-count {
    font-size: 0.5625rem;
    font-weight: 700;
}

.sev-critical {
    color: var(--critical);
}

.sev-warning {
    color: var(--warning);
}

.sev-info {
    color: var(--info);
}

.smell-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 40px 12px;
}

.smell-item {
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 6px;
    transition: all 150ms;
    cursor: default;
}

.smell-item:hover {
    background: rgba(139, 92, 246, 0.04);
}

.smell-item.critical {
    border-left: 3px solid var(--critical);
}

.smell-item.warning {
    border-left: 3px solid var(--warning);
}

.smell-item.info {
    border-left: 3px solid var(--info);
}

.smell-name {
    font-size: 0.6875rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.smell-line {
    font-size: 0.5rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

.smell-desc {
    font-size: 0.5625rem;
    color: var(--text-sec);
    margin-top: 4px;
    line-height: 1.5;
}

.smell-fix {
    font-size: 0.5rem;
    color: var(--secondary);
    margin-top: 4px;
    font-style: italic;
}

.app-footer {
    text-align: center;
    padding: 10px;
    font-size: 0.5625rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

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

    .code-editor-wrapper {
        min-height: 250px;
    }
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(155, 142, 196, 0.15);
    border-radius: 3px;
}