/* =============================================================================
   Manual - Evidence sociálních služeb
   ============================================================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

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

/* Header */
.header {
    background: var(--primary);
    color: white;
    padding: 1.5rem 2rem;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.header-title-block {
    min-width: 0;
}
.header-inner h1 {
    font-size: 1.5rem;
    font-weight: 600;
}
.header-inner .subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
}
.header-logo-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.header-logo {
    display: block;
    width: auto;
    height: auto;
    max-height: 52px;
    max-width: 220px;
}

/* Breadcrumb */
.breadcrumb {
    background: var(--bg-white);
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.breadcrumb a,
.breadcrumb-link {
    color: var(--secondary);
}
.breadcrumb a:hover,
.breadcrumb-link:hover {
    color: var(--primary);
}
.breadcrumb-separator {
    color: var(--text-muted);
    margin: 0 0.5rem;
}
.breadcrumb-current {
    color: var(--text);
    font-weight: 600;
}

/* Main layout */
.main {
    display: flex;
    min-height: calc(100vh - 200px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    flex-shrink: 0;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box {
    position: relative;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: 22rem;
    overflow: auto;
}

.search-result {
    display: block;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result strong {
    display: block;
    color: var(--text);
}

.search-result span,
.search-result small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.35;
}

.search-empty {
    padding: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.nav-menu {
    margin-top: 1.5rem;
}
.nav-menu h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
}
.nav-menu h3:first-child {
    margin-top: 0;
}
.nav-menu ul {
    list-style: none;
}
.nav-details {
    margin-top: 0.75rem;
}
.nav-details summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    padding: 0.25rem 0;
}
.nav-details[open] summary {
    color: var(--primary);
}
.nav-details ul {
    margin-top: 0.35rem;
}
.menu-tree-list {
    display: grid;
    gap: 0.75rem;
}
.menu-tree-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.625rem;
    background: #f8fbff;
}
.menu-tree-group.active-trail {
    border-color: rgba(37, 99, 235, 0.35);
    background: #eef4ff;
}
.menu-tree-head {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.menu1-link {
    display: block;
    flex: 1 1 auto;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
}
.menu-tree-toggle {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-muted);
    cursor: pointer;
}
.menu-tree-toggle:hover {
    color: var(--primary);
    border-color: rgba(37, 99, 235, 0.35);
}
.menu-tree-toggle-icon {
    display: inline-block;
    transition: transform 0.15s ease;
}
.menu-tree-group.is-open .menu-tree-toggle-icon {
    transform: rotate(180deg);
}
.menu1-link.menu1-link-static {
    cursor: default;
}
.menu-tree-sub {
    list-style: none;
    margin: 0.45rem 0 0;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border);
}
.menu-tree-sub li {
    margin: 0.15rem 0;
}
.menu-tree-sub a,
.menu-tree-sub span {
    display: block;
    font-size: 0.82rem;
    color: var(--text);
    padding: 0.15rem 0;
}
.menu-tree-sub a:hover {
    color: var(--primary);
    text-decoration: none;
}
.menu-tree-sub a.active,
.menu1-link.active {
    color: var(--primary);
    font-weight: 600;
}
.nav-menu li a {
    display: block;
    padding: 0.375rem 0;
    color: var(--text);
    font-size: 0.875rem;
}
.nav-menu li a:hover {
    color: var(--primary);
    text-decoration: none;
}
.nav-menu li a.active {
    color: var(--primary);
    font-weight: 500;
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    line-height: 1.2;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    border: 1px solid #cbd5e1;
    vertical-align: baseline;
    margin-left: 0.35rem;
}
.badge-missing {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.topic-filters {
    margin: 0 0 1rem;
}

.topic-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.25rem 0 0.5rem;
}

.topic-filter-chip {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font: inherit;
    font-size: 0.84rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.topic-filter-chip:hover {
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--primary);
}

.topic-filter-chip.is-active {
    background: #e8f0ff;
    border-color: rgba(37, 99, 235, 0.4);
    color: var(--primary-dark);
}

.topic-filter-count {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.topic-filter-chip.is-active .topic-filter-count {
    color: inherit;
}

.topic-filter-state {
    font-size: 0.875rem;
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.5rem 0 1rem;
}

.topic-tags-inline {
    margin: 0.35rem 0 0.25rem;
}

.topic-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: #eef4ff;
    border: 1px solid #c7d2fe;
    color: #1d4ed8;
    font-size: 0.74rem;
    line-height: 1.2;
}

.topic-list-item.is-filtered-out {
    display: none;
}

.topic-list-excerpt {
    display: block;
}

/* Content */
.content {
    flex: 1;
    padding: 2rem;
    max-width: 980px;
}
.content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}
.content h3 {
    font-size: 1.125rem;
    margin: 1.5rem 0 0.75rem;
}
.content p {
    margin-bottom: 1rem;
}

.muted {
    color: var(--text-muted);
}

.codeish {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
}

.doc-text ul,
.doc-text ol {
    margin: 0.5rem 0 1rem 1.5rem;
}

.doc-text li {
    margin: 0.25rem 0;
}

.doc-text pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.75rem;
    border-radius: var(--radius);
    overflow: auto;
    margin: 0.75rem 0 1rem;
}

.doc-text code {
    background: #eef2ff;
    color: #1e3a8a;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.doc-text pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.link-list {
    margin: 0.5rem 0 1rem 1.2rem;
}
.link-list.compact {
    margin-top: 0.35rem;
    margin-bottom: 0;
}

.link-list li {
    margin: 0.35rem 0;
}
.link-list.compact li {
    margin: 0.2rem 0;
}

.meta-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: block;
    margin-bottom: 1.25rem;
}

.meta-table tbody,
.meta-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

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

.meta-table tr:last-child th,
.meta-table tr:last-child td {
    border-bottom: none;
}

.meta-table th {
    width: 28%;
    color: var(--text-muted);
    font-weight: 600;
}

.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 0.75rem 0 0;
}

.screenshot-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-white);
    box-shadow: var(--shadow);
}

.screenshot-card figcaption {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    background: #fafcff;
}

.screenshot-card a {
    display: block;
    background: #f8fafc;
}

.screenshot-card img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: cover;
    object-position: top;
}

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.cards.menu-cards {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.card {
    display: block;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
    text-decoration: none;
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.card h4 {
    color: var(--text);
    margin-bottom: 0.25rem;
}
.card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}
.menu-card {
    cursor: default;
}
.menu-card:hover {
    border-color: var(--border);
    box-shadow: none;
}
.menu-card h4 {
    margin-bottom: 0.35rem;
}
.menu-card .link-list {
    margin-left: 1rem;
}

/* Section page */
.section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.section-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.section-header .meta {
    color: var(--text-muted);
    font-size: 0.875rem;
    max-width: 44rem;
}

.screenshots-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.page-image-view {
    background: #ffffff;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.image-view-main {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 0;
    overflow-x: hidden;
}

.page-image-view .breadcrumb {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.image-view-frame {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 0;
    overflow-x: hidden;
}

.image-view-frame img,
.image-view-image {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    margin: 0 auto;
}

.image-view-missing {
    max-width: 48rem;
    margin: 1.5rem;
}

.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}
.info-box.warning {
    background: #fffbeb;
    border-color: #fde68a;
}
.info-box.danger {
    background: #fef2f2;
    border-color: #fecaca;
}
.info-box.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

details.tech-details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    background: #fafcff;
    margin: 1.25rem 0;
}

details.tech-details summary {
    cursor: pointer;
}

details.tech-details[open] {
    background: var(--bg-white);
}

details.tech-details > section:first-of-type {
    margin-top: 0.75rem;
}

/* Steps */
.steps {
    counter-reset: step;
    margin: 1rem 0;
}
.step {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1.5rem;
}
.step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step h4 {
    margin-bottom: 0.25rem;
}

/* Screenshot */
.screenshot {
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.screenshot img {
    display: block;
    width: 100%;
    height: auto;
}
.screenshot figcaption {
    padding: 0.75rem 1rem;
    background: var(--bg);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Related links */
.related {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.related h3 {
    margin-bottom: 0.75rem;
}
.related ul {
    list-style: none;
}
.related li {
    padding: 0.25rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .main {
        flex-direction: column;
    }
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.85rem;
    }
    .header-logo-wrap {
        justify-content: flex-start;
    }
    .header-logo {
        max-height: 42px;
        max-width: 180px;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .content {
        padding: 1.5rem;
    }
    .screenshot-card img {
        max-height: 320px;
    }
    .image-view-main {
        padding: 0;
    }
    .cards {
        grid-template-columns: 1fr;
    }
    .meta-table,
    .meta-table tbody,
    .meta-table tr {
        display: block;
    }
    .meta-table th,
    .meta-table td {
        display: block;
        width: 100%;
    }
    .meta-table th {
        border-bottom: none;
        padding-bottom: 0.2rem;
    }
    .meta-table td {
        padding-top: 0.2rem;
    }
}
