/*
 * styles.css — Estilos principais da aplicação (index.html)
 */

/* ─── Variáveis e color-scheme ────────────────────────────────────────────── */
:root {
    color-scheme: light dark;

    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --light: #f8fafc;
    --dark: #0f172a;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);

    /* Semantic tokens */
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --editor-bg: #ffffff;
    --editor-text: #1e293b;
    --header-height: 52px;
}

/* Dark mode — via html.dark (FOUC fix) ou body.dark (legado) */
html.dark,
html.dark body,
body.dark {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #263348;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --editor-bg: #1e293b;
    --editor-text: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --light: #1e293b;
    --dark: #f1f5f9;
    --border: #334155;
}

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

/* ─── Base ─────────────────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--primary-dark); text-decoration: underline; }
a:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ─── Container ────────────────────────────────────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.header {
    background: var(--surface);
    color: var(--text);
    padding: 0.65rem 0;
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.header-brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}
.header-brand:hover { color: var(--primary); text-decoration: none; }

.header-brand svg { color: var(--primary); flex-shrink: 0; }

.header-nav {
    display: flex;
    gap: 4px;
}
.header-nav a {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.header-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Layout switcher */
.layout-switcher {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.layout-btn {
    padding: 5px 9px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.layout-btn.active { background: var(--primary); color: white; }
.layout-btn:hover:not(.active) { background: var(--border-color); color: var(--text); }
.layout-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Icon buttons */
.icon-btn {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--border-color); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── Main layout ──────────────────────────────────────────────────────────── */
.main-content {
    display: flex;
    gap: 16px;
    padding: 16px 0 32px;
    flex: 1;
}

/* Ad sidebars — removed */
.ad-sidebar {
    display: none !important;
}

.ad-mobile {
    display: none !important;
}

/* ─── Main area ────────────────────────────────────────────────────────────── */
.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ─── Editor / Preview layouts ─────────────────────────────────────────────── */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-height: 520px;
}

.stacked-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

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

/* ─── Panels (editor & preview) ────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 480px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
    flex-shrink: 0;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.panel-title::before { display: none; }  /* override h2 pseudo */

/* ─── Editor tabs ──────────────────────────────────────────────────────────── */
.panel-tabs {
    display: flex;
    gap: 2px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
}
html.dark .panel-tabs,
body.dark .panel-tabs { background: rgba(255,255,255,0.04); }

.tab-btn {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.15s;
    letter-spacing: 0.03em;
}
.tab-btn.active {
    background: var(--primary);
    color: white;
}
.tab-btn:hover:not(.active) {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}
.tab-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.panel-actions {
    display: flex;
    gap: 6px;
}

.panel-actions .icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}
.panel-actions .icon-btn:hover { color: var(--primary); background: rgba(37, 99, 235, 0.06); border-color: var(--primary); }
html.dark .panel-actions .icon-btn,
body.dark .panel-actions .icon-btn {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* ─── CodeMirror integration ───────────────────────────────────────────────── */
.editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.editor-tab {
    height: 100%;
}

.editor-tab.active {
    display: block;
}

/* Make CM fill the panel */
.editor-tab .CodeMirror {
    height: 100%;
    min-height: 380px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--editor-bg);
    color: var(--editor-text);
}

.editor-tab .CodeMirror-scroll {
    min-height: 380px;
}

html.dark .editor-tab .CodeMirror,
body.dark .editor-tab .CodeMirror {
    background: #1e1e2e;
}

/* ─── Editor actions bar ───────────────────────────────────────────────────── */
.editor-actions {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-2);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.btn:hover { filter: brightness(0.93); }
.btn:active { filter: brightness(0.87); }
.btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); filter: none; }

.btn-secondary { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); color: var(--text); filter: none; }

.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; filter: none; }

html.dark .btn-secondary,
body.dark .btn-secondary { background: var(--surface-2); color: var(--text-muted); border-color: var(--border-color); }
html.dark .btn-secondary:hover,
body.dark .btn-secondary:hover { background: var(--border-color); color: var(--text); }

html.dark .btn-danger,
body.dark .btn-danger { background: rgba(220, 38, 38, 0.12); color: #f87171; border-color: rgba(220, 38, 38, 0.25); }
html.dark .btn-danger:hover,
body.dark .btn-danger:hover { background: rgba(220, 38, 38, 0.2); }

.btn-sm { padding: 4px 10px; font-size: 0.78rem; }

/* ─── Preview panel ────────────────────────────────────────────────────────── */
.preview-panel { min-height: 480px; }

.viewport-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.viewport-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 5px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.15s;
}
.viewport-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.viewport-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.viewport-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.preview-container {
    flex: 1;
    overflow: auto;
    background: var(--surface-2);
    position: relative;
    min-height: 0;
}

html.dark .preview-container,
body.dark .preview-container { background: var(--surface); }

#previewFrame {
    border: none;
    width: 100%;
    height: 100%;
    min-height: 380px;
    display: block;
    background: var(--surface);
    transition: width 0.3s;
}

/* ─── Console JS embutido ──────────────────────────────────────────────────── */
.js-console-panel {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: #1a1a2e;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    max-height: 180px;
}

html.dark .js-console-panel,
body.dark .js-console-panel { background: #0d0d1a; }

.js-console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    background: #111827;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.js-console-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.js-console-badge {
    background: #3b82f6;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.js-console-header .icon-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
}
.js-console-header .icon-btn:hover { color: #9ca3af; background: rgba(255,255,255,0.07); }

.js-console-output {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    min-height: 50px;
}

.js-console-empty {
    color: #4b5563;
    font-size: 0.75rem;
    padding: 8px 12px;
    margin: 0;
    font-style: italic;
}

.js-console-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 2px 12px;
    font-size: 0.78rem;
    line-height: 1.55;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.js-console-line:last-child { border-bottom: none; }

.js-console-icon {
    flex-shrink: 0;
    font-size: 0.7rem;
    margin-top: 2px;
    color: #6b7280;
    width: 12px;
    text-align: center;
}

.js-console-text {
    color: #d1d5db;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
}

.js-console-log   .js-console-icon { color: #6b7280; }
.js-console-log   .js-console-text { color: #d1d5db; }
.js-console-info  .js-console-icon { color: #60a5fa; }
.js-console-info  .js-console-text { color: #93c5fd; }
.js-console-warn  { background: rgba(217, 119, 6, 0.08); }
.js-console-warn  .js-console-icon { color: #f59e0b; }
.js-console-warn  .js-console-text { color: #fcd34d; }
.js-console-error { background: rgba(220, 38, 38, 0.1); }
.js-console-error .js-console-icon { color: #ef4444; }
.js-console-error .js-console-text { color: #fca5a5; }
.js-console-debug .js-console-icon { color: #8b5cf6; }
.js-console-debug .js-console-text { color: #c4b5fd; }

/* ─── Results section ──────────────────────────────────────────────────────── */
.results-section {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.results-section > h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.results-section > h2::before { display: none; }

.results-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-placeholder {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Score card */
.result-score {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
}
.result-score.success { border-color: #86efac; background: #f0fdf4; }
.result-score.warning { border-color: #fcd34d; background: #fffbeb; }
.result-score.error   { border-color: #fca5a5; background: #fef2f2; }

html.dark .result-score.success,
body.dark .result-score.success { background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.3); }
html.dark .result-score.warning,
body.dark .result-score.warning { background: rgba(217,119,6,0.08); border-color: rgba(217,119,6,0.3); }
html.dark .result-score.error,
body.dark .result-score.error   { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.3); }

.score-circle {
    display: flex;
    align-items: baseline;
    gap: 2px;
    font-weight: 700;
}
.score-value { font-size: 2rem; }
.score-max { font-size: 0.85rem; color: var(--text-muted); }

.score-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.score-summary strong { font-size: 1rem; }
.score-summary span { font-size: 0.85rem; color: var(--text-muted); }

/* Individual result items */
.result-item {
    padding: 12px 14px;
    border-left: 4px solid var(--secondary);
    background: var(--surface-2);
    border-radius: 4px;
}
.result-item.error   { border-color: var(--danger); }
.result-item.warning { border-color: var(--warning); }
.result-item.success { border-color: var(--success); }

.result-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.result-item-header h3 {
    font-size: 0.9rem;
    margin: 0;
}

.result-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.result-badge.error   { background: #fef2f2; color: #dc2626; }
.result-badge.warning { background: #fffbeb; color: #d97706; }
.result-badge.success { background: #f0fdf4; color: #16a34a; }

html.dark .result-badge.error,
body.dark .result-badge.error   { background: rgba(220,38,38,0.12); color: #f87171; }
html.dark .result-badge.warning,
body.dark .result-badge.warning { background: rgba(217,119,6,0.12); color: #fbbf24; }
html.dark .result-badge.success,
body.dark .result-badge.success { background: rgba(22,163,74,0.12); color: #4ade80; }

.result-item p {
    font-size: 0.83rem;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.result-fix {
    margin-top: 6px;
}
.result-fix code {
    background: var(--surface);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    color: var(--primary);
    word-break: break-all;
}

/* Results actions row */
.results-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── History section ──────────────────────────────────────────────────────── */
.history-section {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.history-header h2::before { display: none; }

.history-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    transition: border-color 0.15s;
    font-size: 0.82rem;
}
.history-item:hover { border-color: var(--primary); }

.history-score {
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    padding: 2px 6px;
    border-radius: 4px;
}
.history-score.success { background: rgba(40, 167, 69, 0.15); color: #1a7a3a; }
.history-score.warning { background: rgba(230, 168, 23, 0.15); color: #856404; }
.history-score.error   { background: rgba(220, 53, 69, 0.15);  color: #c0392b; }
html.dark .history-score.success,
body.dark .history-score.success { color: #6ee68c; }
html.dark .history-score.warning,
body.dark .history-score.warning { color: #ffd57e; }
html.dark .history-score.error,
body.dark .history-score.error   { color: #f88; }

.history-preview {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Consolas', monospace;
}

.history-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.history-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 16px 0;
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.footer {
    background: #0f172a;
    color: #94a3b8;
    margin-top: 8px;
    border-top: 1px solid #1e293b;
}
html.dark .footer,
body.dark .footer { background: #020617; }

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 1.25rem 1.25rem;
    text-align: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #f1f5f9;
    text-decoration: none;
    transition: color 0.15s;
}
.footer-logo svg { color: #2563eb; }
.footer-logo:hover { color: #93c5fd; text-decoration: none; }

.footer-tagline {
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.55;
    max-width: 280px;
    margin: 0;
    text-align: center;
}

.footer-nav-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 20px;
    list-style: none;
    padding: 0;
    margin: 0;
    align-items: center;
    justify-content: center;
}
.footer-nav-links a {
    font-size: 0.82rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}
.footer-nav-links a:hover { color: #f1f5f9; }

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: #475569;
    font-size: 0.75rem;
}

.footer-github {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #475569;
    text-decoration: none;
    transition: color 0.15s;
}
.footer-github:hover { color: #f1f5f9; text-decoration: none; }

/* ─── Scroll to top ────────────────────────────────────────────────────────── */
#scrollToTop {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transition: all 0.2s;
}
#scrollToTop:hover { background: var(--primary-dark); transform: translateY(-2px); }
#scrollToTop:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

/* ─── Toast notification ───────────────────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #212529;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.87rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 2000;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#toast.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header-content {
        gap: 8px;
    }
    .header-nav { display: none; }
    .main-content { flex-direction: column; padding: 12px 0 24px; }
    .editor-actions { gap: 6px; }
    .btn { padding: 6px 10px; font-size: 0.8rem; }
    .history-item { grid-template-columns: 60px 1fr; }
    .history-date { display: none; }
}

@media (max-width: 480px) {
    .panel-tabs .tab-btn { padding: 4px 8px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 6px; }
    .footer-tagline { max-width: 100%; }
}

/* ─── Pagination dots ──────────────────────────────────────────────────────── */
.page-dots {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 500;
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.35);
    cursor: pointer;
    border: none;
    padding: 0;
    transition: all 0.2s;
    display: block;
    position: relative;
}

.page-dot:hover {
    background: rgba(37, 99, 235, 0.65);
    transform: scale(1.25);
}

.page-dot.active {
    background: var(--primary);
    transform: scale(1.35);
}

.page-dot[title]:hover::after {
    content: attr(title);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #f1f5f9;
    font-size: 0.7rem;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}

html.dark .page-dot[title]:hover::after,
body.dark .page-dot[title]:hover::after {
    background: #334155;
}

@media (max-width: 640px) {
    .page-dots { display: none; }
}

/* ─── Result meta badges (lang + line) ────────────────────────────────────── */
.result-item-header {
    flex-wrap: wrap;
    gap: 6px;
}

.result-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.result-lang-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    line-height: 1.4;
    background: #e2e8f0;
    color: #475569;
}

.result-lang-badge.result-lang-html { background: #fef3c7; color: #92400e; }
.result-lang-badge.result-lang-css  { background: #dbeafe; color: #1e40af; }
.result-lang-badge.result-lang-js   { background: #fef9c3; color: #854d0e; }

html.dark .result-lang-badge,
body.dark .result-lang-badge         { background: #334155; color: #94a3b8; }
html.dark .result-lang-badge.result-lang-html,
body.dark .result-lang-badge.result-lang-html { background: #451a03; color: #fcd34d; }
html.dark .result-lang-badge.result-lang-css,
body.dark .result-lang-badge.result-lang-css  { background: #1e3a5f; color: #93c5fd; }
html.dark .result-lang-badge.result-lang-js,
body.dark .result-lang-badge.result-lang-js   { background: #422006; color: #fde68a; }

.result-line-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
}

html.dark .result-line-badge,
body.dark .result-line-badge { background: #1e293b; color: #94a3b8; }

