/* 1. General style
   ========================================================================== */

body {
    /* font */
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
    font-size:  1rem;
    font-family: sans-serif; /* LODE and W3C use standard sans-serif */
    color: black;
    background-color: white;
}

/* SEARCHBAR */
.toc-float-search {
    position: fixed;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%);
    z-index: 1050;
    display: flex;
    align-items: center;
}

.toc-float-search-toggle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid navy;
    background: #fff;
    color: #005A9C;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.toc-float-search-panel {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.2s ease, opacity 0.2s ease;
}

.toc-float-search.open .toc-float-search-panel {
    width: 320px;
    opacity: 1;
    margin-right: 0.5rem;
}

.toc-float-search-input {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.85rem;
    flex: 1 1 auto;
    min-width: 0;
}

.toc-search-dim {
    opacity: 0.35;
}

.toc-float-search-count {
    font-size: 0.8rem;
    color: #6c757d;
    min-width: 2.5rem;
    text-align: center;
}

.toc-float-search-nav {
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    background: #fff;
    color: #005A9C;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.toc-search-current {
    outline: 3px solid #005A9C;
    outline-offset: 2px;
}

/* Headings - W3C Style Blue */
h1, h2, h3, h4, h5, h6 {
    text-align: left;
    color: #005A9C;
}

h5 {font-size: 110%;}
h4 {font-size: 120%;}
h3 {font-size: 130%;}
h2 {font-size: 140%;}
h1 {font-size: 150%;}

/* Semantic artefact metadata handling */ 
dd {
    line-height: 1.1rem;
}

/* Semantic artefact metadata handling only for SINGLE RESOURCE */ 

.resource-frontmatter {
    border-bottom: 1px solid #ccc;
    padding-bottom: .75rem;
    margin-bottom: .5rem;
}

.resource-title {
    color: #005A9C;
    font-weight: 700;
    font-size: 170%;
    padding: 0;
    margin: 0;
}

.resource-subtitle {
    color: #444;
    font-style: italic;
    font-size: 105%;
    font-weight: 300;
    margin:0;
    padding:0;
}

.resource-subtitle-ontology {
    font-style: normal;
    font-weight: 600;
    color: #005A9C;
}

.resource-meta-line {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: #6c757d;
}

.resource-meta-uri {
    max-width: 60%;
}

.resource-meta-link {
    color: #005A9C !important;
    text-decoration: none !important;
}
.resource-meta-link:hover {
    background-color: #ffa !important;
}

.metadata-accordion-toggle {
    margin-left: auto;   /* spinge il bottone a destra, come i controlli editoriali W3C */
}

.metadata-accordion-summary {
    cursor: pointer;
    list-style: none;
}
.metadata-accordion-summary::-webkit-details-marker {
    display: none;
}

.metadata-accordion-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-left: .75rem;
    border: 1px solid #ccc;
    background: #f9f9f9;
    color: #005A9C;
    font-size: .85rem;
    cursor: pointer;
}
.metadata-accordion-toggle:hover {
    background: #005A9C;
    color: #fff;
}
.metadata-accordion-toggle i {
    transition: transform .2s ease;
}
.metadata-accordion[open] .metadata-accordion-toggle i {
    transform: rotate(180deg);
}

 /* INDEX PAGE STYLE */
.submission-form-container {
    border-bottom:2px solid #193564;
    padding-left: 6rem;
    padding-right: 4rem;
    padding-bottom: 2rem;
    padding-top: 2rem;
}

button[type="submit"] {
    width: 100%;
    padding: 12px;
    background-color: white;
    color: #193564;
    border: solid 2px #193564;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
}

button[type="submit"]:hover {
    background-color: #193564;
    color:white
}

.hide {
    display: none;
}

.info-icon {
    cursor: pointer;
    color: #F3563C;
    font-size: 1.1rem;
}

.info-icon:hover {
    color: #193564;
}

/* Customised switch (e.g., url vs. file) */
.toggle-switch {
    position: relative;
    display: inline-block;
    background: white;
    border: 2px solid #F3563C;
    border-radius: 50px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    padding: 0;
}

.toggle-option {
    display: inline-block;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.toggle-option.inactive {
    color: #F3563C;
    opacity: 0.5;
}

.toggle-option.active {
    color: white;
}

.toggle-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    background: #F3563C;
    border-radius: 50px;
    transition: all 0.3s ease;
    z-index: 1;
}

.toggle-slider.url-mode {
    left: 0;
    width: 50%;
}

.toggle-slider.file-mode {
    left: 50%;
    width: 50%;
}

.text-danger {color: #F3563C}

/* code */
pre {
    background-color: #f5f5f5;
    border: 1px dashed #b0bfcf;
    padding: 0.75rem 1rem;
    color: #000;
    font-family: monospace;
    overflow-x: auto;
    font-size: 0.9em;
}

code {
    font-family: monospace;
    color: #000;
}

/* dentro <pre>, il code non deve riavere bordo/bg proprio */
pre code {
    background: none;
    border: none;
    padding: 0;
}

h1.display-5 {
    font-size: 170%; /* Matching rec.css scaling */
    border-bottom: 2px solid #005A9C;
    padding-bottom: 10px;
}

/* Links - Classic web colors */
a {
    color: #00C !important; /* Standard Blue Link */
    text-decoration: underline;
    background-image: none !important;
    transition: background-size 0.3s ease;
}

a:hover {
    background-color: #ffa !important;
}

a:visited {
    color: #600099; /* Standard Visited Purple */
}

/* Custom styles for the Table of Contents and Sections */
.section-header {
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;}

/* Ensures the title isn't hidden behind browser chrome when jumping */
.anchor-offset {
    scroll-margin-top: 20px;
}
.badge-type {
    font-size: 0.85em;
}

/* 2. Flattening Bootstrap (Removing "App-like" styles)
   ========================================================================== */

/* Remove rounded corners and shadows from everything */
.card, .btn, .alert, .form-control, .badge, .rounded, .rounded-pill {
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* 3. The "Entity" Card Style (Mapping .card to LODE .entity)
   ========================================================================== */

/* The main container for an entity definition */
.card {
    border: 1px solid navy !important; /* LODE signature border */
    margin-bottom: 20px;
    background-color: #fff;
}

/* The Header (Entity Name) */
.card-header {
    background-color: transparent !important; /* Remove Bootstrap gray/white bg */
    border-bottom: 1px solid navy !important;
    padding-top: 5px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    padding-bottom: 5px !important;
    margin-top: 0px !important;
    margin-left: 2px !important;
    margin-right: 2px !important
}

/* The Entity Title */
.card-header h4 {
    font-size: 1.2rem;
    display: inline-block;
    margin-right: 10px;
}

/* Resources style - not better classified */
.external-ref {
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    cursor: help;
    color: inherit;
}

/* 4. Color Coding Types (Classes, Object Properties, etc.)
   ========================================================================== */

.badge {
    background-color: transparent !important; /* Remove bg color */
    font-weight: normal;
    font-size: 0.9em;
    border: none !important;
    padding: 0;
}


/* Concept */
.c ,
.text-info-emphasis {
    color: orange !important;
    font-size: 0.8em;
}

/* Relation */
.op {
    color: navy !important;
    font-size: 0.8em !important;
}

/* Annotaion */
.an {
    color: maroon !important;
    font-size: 0.8em !important;
}

/* Individual */
.ni {
    color: brown !important;
    font-size: 0.8em !important;
}

/* Attributes */
.dp {
    color: green !important;
    font-size: 0.8em !important;
}

/* language */
.lan {
    color: slateblue !important;
    font-size: 0.8em !important;
}

/* 5. Definition Lists (The core of LODE data display)
   ========================================================================== */

/* The gray box effect for descriptions/relations */
.card-body .row {
    margin: 0;
}

/* The label (URI, Relations, etc) */
dt, .text-uppercase.fw-bold {
    color: black !important;
    font-weight: bold !important;
    text-transform: none !important; /* LODE isn't usually uppercase */
    margin-top: 5px;
}

/* The content blocks (Relations lists) */
.bg-light-subtle {
    background-color: rgb(242, 243, 244) !important; /* LODE .description bg */
    border-top: 1px dashed gray !important; /* LODE dashed border */
    border-bottom: 1px dashed gray !important; /* LODE dashed border */
    border-radius: 0 !important;
}

/* URI Code block */
code.bg-light {
    background-color: transparent !important;
    color: black;
    font-family: monospace;
    border: none !important;
    padding: 0 !important;
    font-weight: normal !important;
}

/* 6. Buttons (Make them technical/minimal)
   ========================================================================== */
.btn-outline-secondary, .btn-outline-dark, .btn-outline-primary {
    border: 1px solid #ccc !important;
    color: #005A9C !important;
    background: #f9f9f9;
    padding: 2px 8px;
    font-size: 0.85rem;
    margin-left: 5px;
}

.btn:hover {
    background: #005A9C !important;
    color: white !important;
}

/* 7. Table of Contents (TOC)
   ========================================================================== */
.toc-card {
    border: 1px solid navy !important;
    border-left: 5px solid #005A9C !important;
    background-color: #F4FFFF !important; /* LODE .hlist bg color */
}

.toc-card .btn-outline-primary {
    border: none !important;
    background: transparent !important;
    color: #0000CC !important;
    text-decoration: underline;
    text-align: left;
}

/* 8. Specific Adjustments for Jinja Template Structure
   ========================================================================== */

/* Remove the heavy blue border top from the metadata card */
.border-primary.border-top-4 {
    border-top: none !important;
}

/* Adjust lists inside relationship boxes */
.list-unstyled li {
    margin-bottom: 4px;
}

/* Hide or style the scroll offset anchor */
.anchor-offset {
    scroll-margin-top: 60px;
}

/* Back to index button area */
.mt-3 a.btn {
    border: none !important;
    text-decoration: underline;
}

/* back to table of content button */
.backlink {
    font-size: 10pt !important;
    text-align: right !important;
    float: right !important;
    color: black !important;
    padding: 2px !important;
    border: 1px dotted navy !important;
    background-color: #F4FFFF !important;
}

/* section for attributes */
.attribute {
    border-left: 3px solid #005A9C; /* stesso accento blu delle heading, non colore custom */
}

.statement {
    background-color: white;      /* leggermente più neutro del tuo attuale */
    font-size: 0.92em;
}

/* gli operatori logici dentro lo statement restano leggibili sul nuovo bg */
.statement .logic {
    color: purple;
    font-weight: bold;
}

.logic {
    color: purple;
    font-weight: bold;
}

.inline-markdown > *:last-child {
        display: block !important;
        margin-bottom: 0 !important;
    }

/* Make the container div flow inline */
.markdown-with-badge {
    display: inline !important;
}

.markdown-with-badge:has(pre) {
    display: block !important;
}

/* Pre blocks inside entity cards must establish their own block context */
.markdown-with-badge pre,
.inline-markdown pre {
    display: block !important;
    width: 100%;
    white-space: pre;
}

/* Force ONLY the last paragraph generated by Marked.js to flow inline,
      allowing the badge to sit next to the last word! */
.markdown-with-badge p:last-child {
    display: inline !important;
    margin-bottom: 0 !important;
}

p {
    padding-bottom: 0.5rem;
}

/* Exception: pre/code blocks must stay block even when last child */
.inline-markdown > *:last-child:not(pre) {
    display: inline !important;
    margin-bottom: 0 !important;
}

/* Fix list indentation so bullets don't hit the left border */
.render-markdown ul,
.render-markdown ol {
    padding-left: 1.5rem !important;
    margin-bottom: 0.5rem;
}

/* If the last element is a list, make the list inline */
.markdown-with-badge ul:last-child,
.markdown-with-badge ol:last-child {
    display: inline !important;
    margin-bottom: 0 !important;
    padding-left: 0 !important; /* Remove padding for the inline list */
}

/* Make the LAST item in that list inline so the badge sits next to it */
.markdown-with-badge ul:last-child > li:last-child,
.markdown-with-badge ol:last-child > li:last-child {
    display: inline !important;
}

.markdown-with-badge ul:last-child > li,
.markdown-with-badge ol:last-child > li {
    list-style-type: none !important;
}

/* Re-draw the bullet point for that specific inline item */
.markdown-with-badge ul:last-child > li::before {
    content: "\2022"; /* The official hex code for a bullet point */
    padding-right: 10px; /* Space between the bullet and the text */
    margin-left: 0.65rem; /* Matches the indentation of the other bullets */

    /* THE FIX: Make it larger and align it! */
    font-size: 1.2em;
    line-height: 0;
    vertical-align: middle;
}

.markdown-with-badge p {
    margin-bottom: 0;
}

/* different styles to mark different type of entities - defined by the ontology itself or imported from external vocabs */
.entity-internal { color: var(--lode-link, #005A9C); }
.entity-external { color: var(--lode-external, #6c757d); }
.entity-external .bi { font-size: .75em; opacity: .7; }

/* ============================================================
   RDF provenance accordion
   ============================================================ */

.prov-accordion .accordion-button {
    background: transparent;
    box-shadow: none;
    border-radius: 0.375rem;
}
.prov-accordion .accordion-button:hover {
    background: rgba(13, 110, 253, 0.08);
}
.prov-accordion .accordion-button:not(.collapsed) {
    background: rgba(13, 110, 253, 0.12);
    color: var(--bs-primary);
    box-shadow: none;
}
.prov-accordion .accordion-button:focus {
    box-shadow: none;
}
/* Via la freccia di default di Bootstrap */
.prov-accordion .accordion-button::after {
    display: none;
}
/* L'icona ruota dolcemente quando si apre */
.prov-accordion .accordion-button i {
    transition: transform 0.2s ease;
}
.prov-accordion .accordion-button:not(.collapsed) i {
    transform: rotate(90deg);
}

/* ============================================================
   TOC SIDEBAR 
   ============================================================ */

:root {
    --toc-sidebar-w: 18rem;
    --toc-sidebar-collapsed-w: 3.5rem;
    --toc-sidebar-border: navy;        /* as .card and .toc-card */
    --toc-sidebar-fg: #1a1a1a;
    --toc-sidebar-muted: #6c757d;
    --toc-sidebar-accent: #005A9C;     /* as titles */
}

/* The sidebar lives in the strip body already reserves (margin-left: 5rem).
   When OPEN we widen body's left margin to make room.                       */
body.toc-sidebar-open  { margin-left: calc(var(--toc-sidebar-w) + 1rem); }
body.toc-sidebar-closed { margin-left: 5rem; }

.toc-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--toc-sidebar-w);
    border-right: 2px solid var(--toc-sidebar-border);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, width .2s ease;
    /* rimosso: box-shadow */
}

/* Logo Powered by LODE nella sidebar chiusa */
.toc-sidebar.closed::before {
    content: "";
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    height: 10rem;
    background-image: url('https://www.essepuntato.it/assets/img/lode/LODELogo.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
}

.toc-sidebar.closed {
    width: var(--toc-sidebar-collapsed-w);
}
.toc-sidebar.closed .toc-sidebar-inner { display: none; }

.toc-sidebar-inner {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem .75rem 2rem .75rem;
}

.toc-sidebar-header {
    padding: .25rem .25rem .75rem .25rem;
    border-bottom: 1px solid #d9e1ec;
    margin-bottom: .5rem;
}

.toc-sidebar-title {
    color: var(--toc-sidebar-accent) !important;
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.toc-sidebar-toggle {
    position: absolute;
    top: .5rem;
    right: -1.6rem;
    width: 1.6rem;
    height: 1.6rem;
    border: 1px solid var(--toc-sidebar-border);
    background: #fff;
    color: var(--toc-sidebar-accent);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    /* rimossi: border-radius: 50%; box-shadow */
}
.toc-sidebar-toggle:hover { background: var(--toc-sidebar-accent); color: #fff; }

.toc-sidebar-nav { font-size: .9rem; }

.toc-sidebar-section { margin-bottom: .25rem; }
.toc-sidebar-section[open] > .toc-sidebar-section-head { color: var(--toc-sidebar-accent); }

.toc-sidebar-section-head {
    list-style: none;
    cursor: pointer;
    padding: .3rem .25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-weight: 600;
    color: var(--toc-sidebar-fg);
    border-radius: .25rem;
}
.toc-sidebar-section-head::-webkit-details-marker { display: none; }
.toc-sidebar-section-head::before {
    content: "\25B8"; /* triangle */
    color: var(--toc-sidebar-muted);
    font-size: .7rem;
    margin-right: .15rem;
    transition: transform .15s ease;
    display: inline-block;
}
.toc-sidebar-section[open] > .toc-sidebar-section-head::before {
    transform: rotate(90deg);
}

.toc-sidebar-section-title { flex: 1 1 auto; min-width: 0; }
.toc-sidebar-section-title a {
    color: inherit;
    text-decoration: none;
}
.toc-sidebar-section-title a:hover { text-decoration: underline; }

.toc-sidebar-section-count {
    background: #e7eef7;
    color: var(--toc-sidebar-accent);
    padding: 0 .45rem;
    font-size: .72rem;
    font-weight: 700;
    min-width: 1.6rem;
    text-align: center;
}

.toc-sidebar-list {
    list-style: none;
    padding: .15rem 0 .35rem .9rem;
    margin: 0;
    border-left: 1px dashed #cbd5e1;
    margin-left: .35rem;
}
.toc-sidebar-list li { margin: 0; }
.toc-sidebar-list a {
    display: block;
    color: var(--toc-sidebar-fg);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .85rem;
}
.toc-sidebar-list a:hover {
    background: #e7eef7;
    color: var(--toc-sidebar-accent);
}
.toc-sidebar-list a.active {
    background: var(--toc-sidebar-accent);
    color: #fff;
}

/* ----- Hierarchical tree nodes ----- */
.toc-tree-root,
.toc-tree-children {
    list-style: none;
    margin: 0;
    padding-left: .9rem;
    border-left: 1px dashed #cbd5e1;
}
.toc-tree-root {
    margin-left: .35rem;
    padding-top: .15rem;
    padding-bottom: .35rem;
}
.toc-tree-children {
    margin-left: .15rem;
    padding-top: .1rem;
}

.toc-node { margin: 0; }

.toc-tree-branch > .toc-tree-summary,
.toc-tree-leaf {
    display: block;
    padding: .15rem .4rem;
    color: var(--toc-sidebar-fg);
    text-decoration: none;
    border-radius: .2rem;
    font-size: .85rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-tree-branch > .toc-tree-summary { list-style: none; position: relative; padding-left: 1rem; }
.toc-tree-branch > .toc-tree-summary::-webkit-details-marker { display: none; }
.toc-tree-branch > .toc-tree-summary::before {
    content: "\25B8";
    position: absolute;
    left: .15rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--toc-sidebar-muted);
    font-size: .65rem;
    transition: transform .15s ease;
}
.toc-tree-branch[open] > .toc-tree-summary::before {
    transform: translateY(-50%) rotate(90deg);
}
.toc-tree-branch > .toc-tree-summary a,
.toc-tree-leaf {
    color: var(--toc-sidebar-fg);
}
.toc-tree-branch > .toc-tree-summary a { text-decoration: none; }
.toc-tree-branch > .toc-tree-summary:hover,
.toc-tree-leaf:hover {
    background: #e7eef7;
    color: var(--toc-sidebar-accent);
}
.toc-tree-leaf { padding-left: 1rem; }

.toc-tree-branch > .toc-tree-summary a.active,
.toc-tree-leaf.active {
    background: var(--toc-sidebar-accent);
    color: #fff;
}

/* Mobile: turn into a slide-over instead of squeezing content. */
@media (max-width: 768px) {
    body.toc-sidebar-open,
    body.toc-sidebar-closed { margin-left: 1rem; }
    .toc-sidebar { box-shadow: 4px 0 12px rgba(0,0,0,.12); }
    .toc-sidebar.closed { transform: translateX(calc(-1 * var(--toc-sidebar-w))); width: var(--toc-sidebar-w); }
    .toc-sidebar.closed .toc-sidebar-inner { display: block; }
    .toc-sidebar.closed .toc-sidebar-toggle { right: -2rem; }
}