/* Shared styling for the EU AI Act documentation pages (act.html, requirements.html).
   Self-contained, follows the #179dd9 Kontrol brand used across the app. */

:root {
    --primary-color: #179dd9;
    --primary-dark: #0f7fb0;
    --brand-deep: #0b5c82;
    --brand-tint: #e0f4fb;
    --brand-tint-2: #f0fafd;
    --secondary-color: #6c757d;
    --light-bg: #f8f9fa;
    --border-color: #d9e8f0;
    --text-color: #1e293b;
    --text-light: #52667a;
    --header-grad-a: #179dd9;
    --header-grad-b: #0f7fb0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-padding-top: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    padding: 20px;
}

.doc-page {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 40px);
}

/* ---------- Header ---------- */
.doc-header {
    background: linear-gradient(135deg, var(--header-grad-a) 0%, var(--header-grad-b) 100%);
    color: white;
    padding: 30px 34px 24px;
    text-align: center;
}

.doc-header .logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.doc-header .logo {
    display: block;
    max-height: 64px;
    width: auto;
    max-width: 100%;
    background: #ffffff;
    padding: 8px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.doc-header h1 {
    font-size: 2em;
    margin-bottom: 8px;
    font-weight: 700;
}

.doc-header p.sub {
    font-size: 1.02em;
    opacity: 0.95;
    margin-bottom: 14px;
}

.doc-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.doc-nav a {
    display: inline-block;
    padding: 7px 16px;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.92em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.doc-nav a:hover {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-1px);
}

/* ---------- Body ---------- */
.doc-main {
    flex: 1;
    padding: 26px 34px 40px;
}

/* ---------- Toolbar (act page) ---------- */
.doc-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: var(--brand-tint-2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 22px;
}

.doc-toolbar label {
    font-weight: 600;
    font-size: 0.92em;
    color: var(--text-light);
}

.doc-toolbar input[type="number"] {
    width: 110px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
    color: var(--text-color);
}

.doc-toolbar button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 0.92em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.doc-toolbar button:hover {
    background: var(--primary-dark);
}

.chip-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

.chip {
    padding: 5px 10px;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.chip:hover {
    background: var(--brand-tint);
    border-color: var(--primary-color);
}

.chip-row-label {
    font-weight: 600;
    font-size: 0.92em;
    color: var(--text-light);
    align-self: center;
}

/* ---------- Document lines (act page) ---------- */
.doc-line {
    display: flex;
    align-items: flex-start;
    border-radius: 6px;
    position: relative;
}

.doc-line:hover {
    background: var(--brand-tint-2);
}

.doc-line:target,
.doc-line.js-target {
    background-color: #fff7d6;
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.ln-gutter {
    flex: 0 0 58px;
    text-align: right;
    padding: 3px 10px 3px 0;
    user-select: none;
}

.ln-gutter a {
    color: var(--text-light);
    font-size: 0.76em;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
}

.ln-gutter a:hover {
    color: var(--primary-color);
    opacity: 1;
    text-decoration: underline;
}

.ln-body {
    flex: 1;
    padding: 3px 8px 3px 4px;
    line-height: 1.55;
    font-size: 0.97em;
    min-width: 0;
    word-wrap: break-word;
}

.doc-line.doc-heading .ln-body {
    font-weight: 700;
    color: var(--brand-deep);
    line-height: 1.3;
    padding-top: 10px;
    padding-bottom: 4px;
}

.doc-line.doc-h1 .ln-body { font-size: 1.5em; }
.doc-line.doc-h2 .ln-body { font-size: 1.28em; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; margin-bottom: 4px; }
.doc-line.doc-h3 .ln-body { font-size: 1.12em; }
.doc-line.doc-h4 .ln-body { font-size: 1.04em; color: var(--primary-dark); }

.doc-line.doc-list .ln-body::before {
    content: "•";
    color: var(--primary-color);
    font-weight: 700;
    margin-right: 8px;
}

.doc-line.doc-num .ln-body {
    padding-left: 4px;
}

.doc-line.doc-num .ln-body::before {
    content: attr(data-marker);
    color: var(--primary-dark);
    font-weight: 600;
    margin-right: 8px;
    font-variant-numeric: tabular-nums;
}

.doc-line.doc-para .ln-body {
    text-align: justify;
}

.doc-line.doc-image .ln-body {
    font-style: italic;
    color: var(--text-light);
    background: var(--light-bg);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 6px 0;
}

.doc-blank {
    height: 10px;
}

.doc-line code {
    background: var(--brand-tint);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--brand-deep);
}

.doc-line strong { font-weight: 700; }

/* ---------- Requirements page ---------- */
.req-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.req-stat {
    background: var(--brand-tint-2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.9em;
    color: var(--text-light);
}

.req-stat strong {
    color: var(--brand-deep);
    font-size: 1.1em;
    margin-right: 4px;
}

.req-section {
    margin: 30px 0 14px;
    padding-top: 16px;
    border-top: 2px solid var(--primary-color);
}

.req-section h3 {
    color: var(--brand-deep);
    font-size: 1.22em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.req-section h3 .count {
    background: var(--brand-tint);
    color: var(--primary-dark);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.72em;
    font-weight: 700;
}

.req-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    background: #ffffff;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 10px 0;
    scroll-margin-top: 18px;
    transition: box-shadow 0.15s ease, transform 0.15s ease, background-color 0.25s ease;
}

.req-card:hover {
    box-shadow: 0 6px 18px rgba(23, 157, 217, 0.12);
    transform: translateY(-1px);
}

/* Deep-linked requirement (jumped to from the report or elsewhere). */
.req-card:target {
    background: #fff7d6;
    border-left-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.35);
}

/* Programmatically targeted requirement (added via JavaScript for better compatibility). */
.req-card.is-targeted {
    background: #fff7d6;
    border-left-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.35);
}

.req-card .req-text {
    flex: 1;
    min-width: 0;
}

.req-card .req-title {
    font-weight: 600;
    font-size: 0.99em;
    color: var(--text-color);
    margin-bottom: 3px;
}

.req-card .req-quote {
    font-size: 0.88em;
    color: var(--text-light);
    font-style: italic;
}

.req-card .req-quote::before { content: "“"; }
.req-card .req-quote::after { content: "”"; }

.req-card .req-actions {
    flex: 0 0 auto;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.req-link {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.88em;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.req-link:hover {
    background: var(--primary-dark);
}

.req-link .ln {
    font-variant-numeric: tabular-nums;
}

.req-stored {
    font-size: 0.76em;
    color: var(--text-light);
    opacity: 0.85;
}

.doc-note {
    background: var(--brand-tint);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 0.92em;
    color: var(--text-light);
}

.doc-hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 18px 0;
}

.req-para {
    line-height: 1.6;
    margin: 8px 0;
    font-size: 0.96em;
}

.req-para strong { font-weight: 700; }

.req-list {
    margin: 6px 0 6px 8px;
    padding-left: 4px;
    line-height: 1.6;
    font-size: 0.96em;
}

.req-list::before {
    content: "•";
    color: var(--primary-color);
    font-weight: 700;
    margin-right: 8px;
}

.req-subhead {
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.06em;
    margin: 16px 0 8px;
}

/* ---------- Footer ---------- */
.doc-footer {
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    padding: 16px 34px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85em;
}

/* ---------- Loading / errors ---------- */
.doc-status {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 1.05em;
}

.spinner {
    width: 34px;
    height: 34px;
    margin: 0 auto 16px;
    border: 4px solid var(--brand-tint);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.doc-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 20px 0;
    font-size: 0.95em;
}

@media (max-width: 720px) {
    body { padding: 8px; }
    .doc-main { padding: 16px 14px 30px; }
    .doc-header { padding: 22px 16px 18px; }
    .ln-gutter { flex-basis: 42px; }
    .req-card { flex-direction: column; }
    .req-card .req-actions { align-items: flex-start; }
    .chip-row { margin-left: 0; width: 100%; }
}
