/* GC Log Analyzer - Main Stylesheet (adapted from JVM Profiling Toolkit) */

:root {
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-hover: #f1f5f9;
    --bg-accent: #4f46e5;
    --bg-accent-hover: #4338ca;
    --bg-accent-subtle: #eef2ff;
    --bg-danger: #fef2f2;
    --bg-danger-btn: #ef4444;
    --bg-sidebar: #1e293b;
    --bg-sidebar-section: #273548;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-accent: #ffffff;
    --text-sidebar: #cbd5e1;
    --text-sidebar-heading: #94a3b8;
    --text-sidebar-active: #ffffff;
    --border: #e2e8f0;
    --border-focus: #4f46e5;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --radius: 8px;
    --radius-lg: 12px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--bg-accent); text-decoration: none; }
a:hover { color: var(--bg-accent-hover); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }

ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.25rem; }

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

/* ---- Layout ---- */
.container { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card { margin-top: 1.5rem; }
.card-body { padding: 1.5rem; }
.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.card-header:hover { background: var(--bg-hover); }
.card-header .chevron {
    transition: transform 0.2s;
    width: 16px;
    height: 16px;
    opacity: 0.5;
}
.card-header.collapsed .chevron { transform: rotate(-90deg); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    line-height: 1.5;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }

.btn-primary {
    background: var(--bg-accent);
    color: var(--text-on-accent);
    border-color: var(--bg-accent);
}
.btn-primary:hover {
    background: var(--bg-accent-hover);
    border-color: var(--bg-accent-hover);
    color: var(--text-on-accent);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}
.form-input, select.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.875rem;
    background: var(--bg-input);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-input:focus, select.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
    cursor: pointer;
    appearance: auto;
}

textarea.form-input {
    resize: vertical;
    min-height: 120px;
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.5;
}

input[type="file"].form-input {
    padding: 0.375rem 0.75rem;
}
input[type="file"]::file-selector-button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background 0.15s;
}
input[type="file"]::file-selector-button:hover { background: var(--bg-hover); }

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
table.data-table th {
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-hover);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
table.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
table.data-table tbody tr:hover { background: var(--bg-hover); }
table.data-table td:nth-of-type(n+2) { text-align: right; }
table.data-table td.text-left { text-align: left; }
table.data-table td.text-center { text-align: center; }
table.data-table th.text-center { text-align: center; }
table.data-table th.text-right { text-align: right; }

table.data-table thead.sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-with-link-green { color: #059669; font-weight: 600; }
.table-with-link-red { color: #dc2626; font-weight: 600; }

/* ---- Search ---- */
.search-box {
    position: relative;
    margin-bottom: 1rem;
}
.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.875rem;
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.875rem;
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ---- Hero Section ---- */
.hero {
    text-align: center;
    padding: 4rem 0 2rem;
}
.hero h1 { margin-bottom: 0.5rem; }
.hero p { color: var(--text-secondary); font-size: 1.125rem; margin-bottom: 2rem; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: left;
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
    color: var(--text);
}
.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--text);
}
.feature-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}
.feature-card .icon-upload { background: #eef2ff; color: #4f46e5; }
.feature-card .icon-docker { background: #eff6ff; color: #2563eb; }
.feature-card .icon-github { background: #f0fdf4; color: #059669; }
.feature-card .icon-blog { background: #fef3c7; color: #d97706; }
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }

/* ---- Page Header ---- */
.page-header {
    margin-bottom: 2rem;
}
.page-header h1 { margin-bottom: 0.25rem; }
.page-header p { color: var(--text-secondary); }

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 2rem 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.footer a { color: var(--text-secondary); }

/* ---- Viewer Layout (sidebar + content) ---- */
.viewer-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    gap: 0;
}
.viewer-sidebar {
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    padding: 0;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
}
.viewer-sidebar .sidebar-brand {
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-sidebar-active);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.viewer-sidebar .sidebar-brand a {
    color: var(--text-sidebar-active);
    text-decoration: none;
}
.viewer-sidebar .sidebar-brand a:hover {
    color: var(--text-sidebar-active);
    text-decoration: none;
}

.viewer-sidebar .nav-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}
.viewer-sidebar .nav-item {
    list-style: none;
}
.viewer-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    color: var(--text-sidebar);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    cursor: pointer;
}
.viewer-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-sidebar-active);
    text-decoration: none;
    border-left-color: rgba(255,255,255,0.2);
}
.viewer-sidebar .nav-link.active {
    color: var(--text-sidebar-active);
    background: rgba(255,255,255,0.08);
    border-left-color: var(--bg-accent);
}
.viewer-sidebar .nav-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}
.viewer-sidebar .nav-link:hover svg,
.viewer-sidebar .nav-link.active svg {
    opacity: 1;
}

.viewer-content {
    padding: 2rem;
    background: var(--bg);
    overflow-x: hidden;
}

/* ---- Alerts ---- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
}
.alert a { text-decoration: underline; }
.alert-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}
.alert-warning a { color: #92400e; }
.alert-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}
.alert-success a { color: #166534; }
.alert-danger {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}
.alert-danger a { color: #991b1b; }
.alert h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* ---- Progress Bar ---- */
.progress {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.75rem;
}
.progress-bar {
    height: 100%;
    background: var(--bg-accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ---- Code Blocks ---- */
pre {
    margin-bottom: 0.75rem;
    border-radius: var(--radius);
    overflow-x: auto;
}
pre code {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--bg-sidebar);
    color: var(--text-sidebar-active);
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.6;
}
code {
    font-family: var(--mono);
    font-size: 0.875em;
}
kbd {
    background: var(--bg-sidebar);
    color: var(--text-sidebar-active);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 0.8125em;
    white-space: nowrap;
}

mark {
    background: #fef3cd;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* ---- Definition List ---- */
dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}
dt { font-weight: 500; }
dd { margin: 0; color: var(--text-secondary); }

/* ---- Collapse ---- */
.collapse { display: none; }
.collapse.show { display: block; }

/* ---- Spinner ---- */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--bg-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Centered Page (waiting, errors) ---- */
.centered-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.centered-page .card {
    max-width: 560px;
    width: 100%;
}

/* ---- Error Pages ---- */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}
.error-page .error-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--bg-accent);
    line-height: 1;
    margin-bottom: 0.5rem;
}
.error-page h2 { color: var(--text); margin-bottom: 0.75rem; }
.error-page p { color: var(--text-secondary); }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--mono); font-size: 0.8125rem; }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.w-auto { width: auto; }

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    margin-top: 1.25rem;
    color: var(--text);
}

/* Highcharts figure */
.highcharts-figure {
    margin: 0;
}
