/* CodeSnoop - Dark security dashboard theme */
:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-hover: #21262d;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-dim: #388bfd;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --orange: #db6d28;
    --font-sans: 'Outfit', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-dark);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

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

.logo {
    font-size: 1.5rem;
    color: var(--accent);
}

.brand h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

.app-header nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
}

.app-header nav a:hover,
.app-header nav a.active {
    color: var(--accent);
    background: var(--bg-hover);
}

.app-header nav .btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: var(--radius);
    text-decoration: none;
    display: inline-block;
}

.app-header nav .btn-ghost:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* Scan page */
.page-scan .scan-form-container {
    max-width: 560px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Settings page */
.page-settings .settings-container {
    max-width: 560px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.settings-card h2 {
    margin-top: 0;
    font-size: 1.2rem;
}

.settings-intro {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1.25rem 0;
}

.settings-form .field {
    margin-bottom: 1.25rem;
}

.settings-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.settings-form select {
    width: 100%;
    max-width: 320px;
    padding: 0.6rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
}

.settings-form input[type="number"],
.settings-form input[type="text"].settings-tz-other {
    width: 100%;
    max-width: 320px;
    padding: 0.6rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
}

.settings-form input[type="number"] {
    max-width: 120px;
}

.settings-form .form-actions {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-message {
    font-size: 0.9rem;
}

.scan-card h2 {
    margin-top: 0;
    font-size: 1.2rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.scan-form .field {
    margin-bottom: 1.25rem;
}

.scan-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--text);
}

.scan-form input[type="url"],
.scan-form input[type="number"],
.search-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.scan-form input:focus,
.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.field-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

.radio-label input,
.checkbox-label input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}

.form-actions {
    margin-top: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

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

.btn-primary:hover {
    background: var(--accent-dim);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.btn-icon:hover {
    color: var(--text);
}

/* Progress */
.scan-progress {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.progress-bar-wrap {
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 500;
    margin: 0 0 0.25rem 0;
}

.progress-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}

.message-error {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid var(--red);
    color: #ff7b72;
}

.message-success {
    background: rgba(63, 185, 80, 0.15);
    border: 1px solid var(--green);
    color: #56d364;
}

.message-success a {
    color: var(--accent);
}

/* Dashboard layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    min-height: calc(100vh - 56px);
}

.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1rem;
    overflow-y: auto;
}

.sidebar-section h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.scan-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0;
}

.scan-list li {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
}

.scan-list li:hover {
    background: var(--bg-hover);
}

.scan-list li.active {
    background: var(--accent);
    color: #fff;
}

.scan-list li.empty-state {
    cursor: default;
    color: var(--text-muted);
}

.scan-list .scan-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.scan-list li.active .scan-meta {
    color: rgba(255, 255, 255, 0.8);
}

.main-panel {
    padding: 1rem;
    overflow-y: auto;
}

.empty-card {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 2rem;
}

.empty-card a {
    color: var(--accent);
}

/* Summary */
.summary-card h2,
.filters-card .filters-row,
.table-card {
    margin-bottom: 1rem;
}

.summary-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat {
    padding: 0.75rem 1.25rem;
    background: var(--bg-dark);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
}

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

.stat-high .stat-value { color: var(--red); }
.stat-medium .stat-value { color: var(--yellow); }
.stat-low .stat-value { color: var(--accent); }

.summary-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-inline input {
    padding: 0.35rem 0.5rem;
    width: 180px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.filters-row .search-input {
    flex: 1;
    min-width: 160px;
}

.filters-row select {
    padding: 0.5rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

/* Table */
.table-wrap {
    overflow-x: auto;
}

.findings-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.findings-table th,
.findings-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.findings-table th {
    position: relative;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
    padding-right: 1rem;
}

.findings-table .col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
}

.findings-table .col-resizer:hover {
    background: rgba(88, 166, 255, 0.2);
}

.findings-table tbody tr {
    cursor: pointer;
}

.findings-table tbody tr:hover {
    background: var(--bg-hover);
}

.findings-table tbody tr.selected {
    background: rgba(88, 166, 255, 0.15);
    border-left: 3px solid var(--accent);
}

.findings-table .content-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.findings-table .url-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.findings-table .date-cell {
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-high {
    background: rgba(248, 81, 73, 0.25);
    color: #ff7b72;
}

.badge-medium {
    background: rgba(210, 153, 34, 0.25);
    color: #e3b341;
}

.badge-low {
    background: rgba(88, 166, 255, 0.25);
    color: #79c0ff;
}

.badge-none {
    background: var(--bg-hover);
    color: var(--text-muted);
}

/* Inspector panel */
.inspector-panel {
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 1rem;
    overflow-y: auto;
}

.inspector-placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem 1rem;
}

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

.inspector-header h3 {
    margin: 0;
    font-size: 1rem;
}

.inspector-meta {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.inspector-meta > div {
    margin-bottom: 0.5rem;
}

.inspector-meta .mono {
    word-break: break-all;
    font-size: 0.85rem;
}

.content-pre {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 240px;
    overflow-y: auto;
    margin: 0 0 0.5rem 0;
}

.inspector-content-block label,
.inspector-actions label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.inspector-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.inspector-actions textarea {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    resize: vertical;
}

.status-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.status-confirmed { background: rgba(63, 185, 80, 0.2); color: #56d364; }
.status-fp { background: rgba(139, 148, 158, 0.2); color: var(--text-muted); }
.status-review { background: rgba(210, 153, 34, 0.2); color: #e3b341; }

.mono {
    font-family: var(--font-mono);
}

/* Expand row */
.tr-expanded .content-cell {
    white-space: pre-wrap;
    max-width: none;
    word-break: break-all;
}

/* Highlight in content */
.highlight {
    background: rgba(210, 153, 34, 0.35);
    padding: 0 2px;
}

/* Guide modal */
.guide-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s;
}

.guide-modal.is-open {
    visibility: visible;
    opacity: 1;
}

.guide-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.guide-dialog {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.guide-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.guide-close {
    font-size: 1.5rem;
    line-height: 1;
}

.guide-body {
    overflow-y: auto;
    padding: 1.25rem;
}

.guide-intro {
    color: var(--text-muted);
    margin: 0 0 1.25rem 0;
    font-size: 0.95rem;
}

.guide-section {
    margin-bottom: 1.5rem;
}

.guide-section:last-child {
    margin-bottom: 0;
}

.guide-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--accent);
}

.guide-section p {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text);
}

.guide-dl {
    margin: 0;
    font-size: 0.9rem;
}

.guide-dl dt {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

.guide-dl dt:first-child {
    margin-top: 0;
}

.guide-dl dd {
    margin: 0 0 0 0;
    padding-left: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.guide-dl code {
    background: var(--bg-dark);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.guide-section ul {
    margin: 0 0 0.5rem 0;
    padding-left: 1.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.guide-section ul li {
    margin-bottom: 0.35rem;
}

/* Inspector inline help */
.inspector-help {
    margin: 0.75rem 0;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
}

.guide-inline-toggle {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.guide-inline-toggle:hover {
    text-decoration: underline;
}

.inspector-help-content {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.inspector-help-content p {
    margin: 0 0 0.35rem 0;
}

.inspector-help-content p:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .inspector-panel {
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 640px) {
    .summary-stats {
        flex-direction: column;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
}
