:root {
    --primary: #F59E0B;
    --primary-hover: #D97706;
    --secondary: #FCD34D;
    --accent: #6366F1;
    --bg-dark: #1A150A;
    --bg-panel: rgba(36, 28, 15, 0.7);
    --bg-input: rgba(20, 15, 5, 0.8);
    --text-main: #FDF6E3;
    --text-muted: #A39679;
    --border: rgba(107, 85, 43, 0.4);

    --color-critical: #EF4444;
    --bg-critical: rgba(239, 68, 68, 0.1);
    --color-warning: #F59E0B;
    --bg-warning: rgba(245, 158, 11, 0.1);
    --color-info: #3B82F6;
    --bg-info: rgba(59, 130, 246, 0.1);

    --diff-add-bg: rgba(16, 185, 129, 0.15);
    --diff-add-text: #34D399;
    --diff-del-bg: rgba(239, 68, 68, 0.15);
    --diff-del-text: #F87171;
    --diff-meta: #A39679;

    --glass-border: 1px solid rgba(245, 158, 11, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 40%);
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.header-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    main {
        grid-template-columns: 350px 1fr;
    }
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
}

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

textarea {
    width: 100%;
    height: calc(100vh - 350px);
    min-height: 300px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-main);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--primary);
    color: #000;
    padding: 0.75rem 1.5rem;
    width: 100%;
    font-weight: 600;
}

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

.primary-btn:active {
    transform: translateY(0);
}

.icon-btn {
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: 4px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.text-btn {
    color: var(--accent);
    font-size: 0.85rem;
}

.text-btn:hover {
    text-decoration: underline;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hidden {
    display: none !important;
}

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    height: 300px;
    color: var(--text-muted);
    background: var(--bg-panel);
    border-radius: var(--radius);
    border: var(--glass-border);
}

.scanner {
    width: 80px;
    height: 80px;
    border: 2px solid var(--border);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.scanner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    animation: scan 1.5s ease-in-out infinite alternate;
}

@keyframes scan {
    from {
        top: 0;
    }

    to {
        top: 100%;
    }
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.card {
    background: var(--bg-panel);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-critical {
    border-top: 3px solid var(--color-critical);
}

.card-warning {
    border-top: 3px solid var(--color-warning);
}

.card-info {
    border-top: 3px solid var(--color-info);
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.card-critical .card-icon {
    color: var(--color-critical);
    background: var(--bg-critical);
}

.card-warning .card-icon {
    color: var(--color-warning);
    background: var(--bg-warning);
}

.card-info .card-icon {
    color: var(--color-info);
    background: var(--bg-info);
}

.card-content h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.code-font {
    font-family: 'Fira Code', monospace;
}

.filter-toggles {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.toggle-lbl {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.toggle-lbl:hover {
    color: var(--text-main);
}

.toggle-lbl input {
    accent-color: var(--primary);
}

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

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

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

.report-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.report-item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 6px;
    padding: 1rem;
}

.report-item.severity-critical {
    border-left-color: var(--color-critical);
}

.report-item.severity-warning {
    border-left-color: var(--color-warning);
}

.report-item.severity-info {
    border-left-color: var(--color-info);
}

.report-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.report-title {
    font-weight: 600;
    color: var(--text-main);
}

.report-file {
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
}

.report-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.report-code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--diff-add-text);
    overflow-x: auto;
}

.diff-container {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.diff-line {
    display: flex;
    padding: 0.1rem 1rem;
    white-space: pre-wrap;
    word-break: break-all;
    position: relative;
}

.diff-hoverable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.diff-line.add {
    background-color: var(--diff-add-bg);
    color: var(--diff-add-text);
}

.diff-line.del {
    background-color: var(--diff-del-bg);
    color: var(--diff-del-text);
}

.diff-line.meta {
    color: var(--diff-meta);
    background: rgba(0, 0, 0, 0.2);
    margin: 0.5rem 0;
    padding: 0.25rem 1rem;
    font-weight: 600;
}

.diff-line.hunk {
    color: var(--accent);
    background: rgba(0, 0, 0, 0.2);
}

.diff-line-num {
    width: 40px;
    min-width: 40px;
    text-align: right;
    padding-right: 1rem;
    color: var(--border);
    user-select: none;
}

.diff-line-content {
    flex: 1;
}

.line-annotation {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-panel);
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    opacity: 0.8;
}

.line-annotation.critical {
    color: var(--color-critical);
}

.line-annotation.warning {
    color: var(--color-warning);
}

.line-annotation.info {
    color: var(--color-info);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}