/* ───────────────────────────────────────────────────────────────
   MediaTool — design system on top of Bootstrap 5.
   Loaded after bootstrap.min.css so the variables below win.
   No build step (Sass / Tailwind) — plain CSS custom properties.
   ─────────────────────────────────────────────────────────────── */

:root {
    /* Palette */
    --mt-primary:           #2563eb;
    --mt-primary-hover:     #1d4ed8;
    --mt-success:           #16a34a;
    --mt-warning:           #ea580c;
    --mt-danger:            #dc2626;
    --mt-info:              #0891b2;

    --mt-text:              #0f172a;
    --mt-text-muted:        #64748b;
    --mt-text-subtle:       #94a3b8;

    --mt-bg:                #f4f5f8;
    --mt-surface:           #ffffff;
    --mt-surface-alt:       #f8fafc;
    --mt-border:            #e2e8f0;
    --mt-border-strong:     #cbd5e1;

    --mt-sidebar-bg:        #0f172a;
    --mt-sidebar-fg:        #cbd5e1;
    --mt-sidebar-fg-active: #ffffff;
    --mt-sidebar-active-bg: rgba(37, 99, 235, 0.18);
    --mt-sidebar-hover-bg:  rgba(255, 255, 255, 0.06);
    --mt-sidebar-divider:   rgba(255, 255, 255, 0.08);

    --mt-radius-sm: 4px;
    --mt-radius:    8px;
    --mt-radius-lg: 12px;

    --mt-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.04);
    --mt-shadow:    0 2px 4px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);

    --mt-sidebar-width: 248px;
}

/* ─── Base typography ──────────────────────────────────────────── */

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    color: var(--mt-text);
}

body {
    background: var(--mt-bg);
    margin: 0;
}

a { color: var(--mt-primary); }
a:hover { color: var(--mt-primary-hover); }

/* ─── App shell: sidebar + main ────────────────────────────────── */

.mt-app {
    display: flex;
    min-height: 100vh;
}

.mt-sidebar {
    width: var(--mt-sidebar-width);
    flex: 0 0 var(--mt-sidebar-width);
    background: var(--mt-sidebar-bg);
    color: var(--mt-sidebar-fg);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
}

.mt-sidebar-brand {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.4px;
    padding: 10px 12px 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mt-sidebar-brand:hover { color: #fff; }

.mt-sidebar-section-label {
    color: var(--mt-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    padding: 14px 12px 6px;
}

.mt-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0 0 auto 0;
}

.mt-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--mt-sidebar-fg);
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
    font-size: 0.95rem;
}

.mt-sidebar-nav a:hover {
    background: var(--mt-sidebar-hover-bg);
    color: var(--mt-sidebar-fg-active);
}

.mt-sidebar-nav a.active {
    background: var(--mt-sidebar-active-bg);
    color: var(--mt-sidebar-fg-active);
}

.mt-sidebar-nav a i {
    width: 16px;
    text-align: center;
    opacity: 0.9;
}

.mt-sidebar-footer {
    border-top: 1px solid var(--mt-sidebar-divider);
    padding: 14px 4px 0;
    margin-top: 14px;
    font-size: 0.82rem;
    color: var(--mt-text-subtle);
}

.mt-sidebar-footer .mt-sidebar-email {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
    padding: 0 8px;
}

.mt-sidebar-footer .btn-logout {
    width: 100%;
    background: transparent;
    border: 1px solid var(--mt-sidebar-divider);
    color: var(--mt-sidebar-fg);
    font-size: 0.85rem;
    border-radius: 6px;
    padding: 6px 10px;
}

.mt-sidebar-footer .btn-logout:hover {
    background: var(--mt-sidebar-hover-bg);
    color: #fff;
}

.mt-main {
    flex: 1 1 auto;
    padding: 28px 36px;
    min-width: 0; /* allow children with overflow to compress */
}

/* On narrow screens — collapse sidebar to top strip */
@media (max-width: 768px) {
    .mt-app { flex-direction: column; }
    .mt-sidebar { width: 100%; flex: 0 0 auto; height: auto; position: static; }
    .mt-main { padding: 20px; }
}

/* ─── Cards (Bootstrap baseline + softer feel) ─────────────────── */

.card {
    border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius);
    box-shadow: var(--mt-shadow-sm);
    background: var(--mt-surface);
}

.card-header {
    background: var(--mt-surface);
    border-bottom: 1px solid var(--mt-border);
    font-weight: 500;
    border-radius: var(--mt-radius) var(--mt-radius) 0 0 !important;
}

.list-group-item {
    border-color: var(--mt-border);
}

/* ─── SEO block — left-aligned, full-width fields, wrappable rows ─ */

.seo-block .seo-field {
    margin-bottom: 18px;
}

.seo-block .seo-field:last-child {
    margin-bottom: 0;
}

.seo-block .seo-field-label {
    display: block;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--mt-text-muted);
    margin-bottom: 6px;
    text-align: left;
}

.seo-block .list-group-item {
    align-items: flex-start;
    text-align: left;
    word-break: break-word;
    gap: 8px;
}

.seo-block .list-group-item > .seo-text {
    flex: 1 1 auto;
    min-width: 0;
}

.seo-block .input-group {
    width: 100%;
    align-items: stretch;
}

.seo-block .input-group .form-control,
.seo-block .input-group code.form-control {
    background: var(--mt-surface-alt);
    color: var(--mt-text);
    border-color: var(--mt-border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-align: left;
    user-select: all;
    line-height: 1.5;
    padding: 0.4rem 0.75rem;
}

/* Copy buttons — same baseline everywhere. Outline-secondary is invisible on
   a white surface; give it a soft fill + visible border, primary on hover. */
.copy-text,
.seo-block .input-group .btn,
.btn-outline-secondary.copy-md {
    background-color: var(--mt-surface-alt);
    border: 1px solid var(--mt-border-strong);
    color: var(--mt-text);
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copy-text:hover,
.seo-block .input-group .btn:hover,
.btn-outline-secondary.copy-md:hover {
    background-color: var(--mt-primary);
    border-color: var(--mt-primary);
    color: #fff;
}

/* Technical checklist — Claude emits each line separated by a single \n,
   which Markdig collapses into a single <p>. Bypass Markdig and use pre-line
   so every newline becomes a visual break, with a leading ✓ per item. */
.tech-checklist {
    white-space: pre-line;
    line-height: 1.75;
    font-size: 0.9rem;
    color: var(--mt-text);
}

/* ─── Article body typography ─────────────────────────────────── */

.article-body {
    font-size: 1rem;
    line-height: 1.65;
    color: var(--mt-text);
}

.article-body h1, .article-body h2, .article-body h3 {
    margin-top: 1.4em;
    margin-bottom: 0.6em;
    font-weight: 600;
}

.article-body h1 { font-size: 1.5rem; }
.article-body h2 { font-size: 1.25rem; }
.article-body h3 { font-size: 1.1rem; }

.article-body p { margin-bottom: 0.9em; }

.article-body strong { color: var(--mt-text); font-weight: 600; }

.article-body ul, .article-body ol { padding-left: 1.4em; }

.article-md {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    background: var(--mt-surface-alt);
    border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius);
    padding: 14px 16px;
    color: var(--mt-text);
}

/* ─── Reviewer / debug JSON blocks ─────────────────────────────── */

pre.yaml {
    background: #0d1117;
    color: #e6edf3;
    padding: 1rem;
    border-radius: var(--mt-radius);
    max-height: 60vh;
    overflow: auto;
    font-size: 0.85rem;
}

textarea.yaml {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    min-height: 480px;
}

/* ─── Status badges (kept from old layout) ────────────────────── */

.score-pill { font-variant-numeric: tabular-nums; }

.badge-status-new       { background:#64748b; }
.badge-status-ranked    { background:#2563eb; }
.badge-status-written   { background:#ea580c; }
.badge-status-reviewed  { background:#16a34a; }
.badge-status-archived  { background:#94a3b8; }

/* ─── Auth shell (login page) ─────────────────────────────────── */

.mt-auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: var(--mt-bg);
}

.mt-auth-card {
    width: 100%;
    max-width: 520px;
}

.mt-auth-card .card-body {
    padding: 2rem 2.25rem;
}

.mt-auth-card .form-control {
    padding: 0.55rem 0.85rem;
    font-size: 1rem;
}

.mt-auth-card .btn {
    padding: 0.55rem 1rem;
    font-size: 1rem;
}
