/* =====================================================
   Semantic HTML Checker — styles.css
   Green/Blue premium dark mode
   ===================================================== */

:root {
    --primary: #10B981;
    --secondary: #34D399;
    --accent: #3B82F6;
    --bg: #0F1219;
    --surface: #141C27;
    --surface2: #1A2335;
    --border: rgba(16, 185, 129, 0.15);
    --text: #E0FFF5;
    --text-muted: #4D7A68;
    --red: #EF4444;
    --yellow: #F59E0B;
    --green: #10B981;
    --blue: #3B82F6;
    --radius: 12px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 10% 0%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

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

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

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

.hidden {
    display: none !important;
}

.glass-card {
    background: rgba(20, 28, 39, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ── Header ───────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 18, 25, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 11px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-title {
    font-size: 1rem;
    font-weight: 700;
}

.logo-sub {
    font-size: 0.63rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #059669);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 8px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: box-shadow var(--transition), transform var(--transition);
}

.btn-primary:hover {
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 7px 13px;
    cursor: pointer;
    transition: all var(--transition);
}

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

/* ── Main ─────────────────────────────────────────── */
.main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    position: relative;
    z-index: 1;
}

/* ── Input ────────────────────────────────────────── */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: calc(100vh - 120px);
}

.input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
}

.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.line-count {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.editor-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.line-nums {
    background: var(--surface2);
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: right;
    user-select: none;
    min-width: 42px;
    overflow: hidden;
}

.html-editor {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.6;
    resize: none;
    white-space: pre;
    overflow-x: auto;
    overflow-y: auto;
    tab-size: 2;
}

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

.html-editor:focus {
    outline: none;
}

.parse-error {
    margin: 8px 14px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    font-size: 0.78rem;
    color: #FCA5A5;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Results ──────────────────────────────────────── */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Score card */
.score-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
}

.score-ring-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.score-ring {
    display: block;
}

.score-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.score-grade {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.score-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.score-meta {
    display: flex;
    flex-direction: column;
}

/* Issues */
.issues-card {
    overflow: hidden;
}

.issue-badge {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.65rem;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
}

.issue-list {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 8px;
}

.issue-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.issue-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.issue-text {
    flex: 1;
}

.issue-title {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.issue-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.issue-badge-sev {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sev-error {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
}

.sev-warn {
    background: rgba(245, 158, 11, 0.15);
    color: #FCD34D;
}

.sev-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93C5FD;
}

.sev-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #6EE7B7;
}

/* Heading tree */
.tree-card {
    overflow: hidden;
}

.heading-tree {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.h-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    background: var(--surface2);
    border: 1px solid var(--border);
    transition: background var(--transition);
}

.h-node:hover {
    background: rgba(16, 185, 129, 0.08);
}

.h-level {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.h-level-1 {
    background: rgba(16, 185, 129, 0.25);
    color: var(--primary);
}

.h-level-2 {
    background: rgba(59, 130, 246, 0.2);
    color: #60A5FA;
}

.h-level-3 {
    background: rgba(245, 158, 11, 0.15);
    color: #FCD34D;
}

.h-level-4 {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
}

.h-level-56 {
    background: rgba(139, 92, 246, 0.15);
    color: #C4B5FD;
}

.h-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.h-warn {
    color: var(--red);
    font-size: 0.72rem;
}

/* Landmarks */
.landmarks-card {
    overflow: hidden;
}

.landmarks-list {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.landmark-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid;
    transition: transform var(--transition);
}

.landmark-chip:hover {
    transform: scale(1.05);
}

.landmark-present {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--primary);
}

.landmark-missing {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: #FCA5A5;
}

/* Element chart */
.elem-chart {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-label {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    width: 80px;
    flex-shrink: 0;
}

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

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

.chart-count {
    font-size: 0.68rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    min-width: 24px;
    text-align: right;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1100px) {
    .main {
        grid-template-columns: 1fr 360px;
    }
}

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

@media (max-width: 640px) {
    .main {
        padding: 14px;
    }
}