/* FTL Amministrazione Trasparente - Frontend CSS */
.ftl-at-wrapper { font-family: inherit; }
.ftl-at-header { margin-bottom: 32px; padding-bottom: 16px; border-bottom: 2px solid #1a6fb8; }
.ftl-at-title { font-size: 1.8rem; margin: 0 0 8px; color: #1a2a3a; }
.ftl-at-subtitle { color: #555; margin: 0; }

/* ── MENU ACCORDION LATERALE ─────────────────────────────────── */
.ftl-at-nav {
    background: #fff;
    border: 1px solid #e0e7ef;
    border-radius: 8px;
    overflow: hidden;
    font-size: .875rem;
}
.ftl-at-nav__header {
    background: #1a6fb8;
    padding: 14px 16px;
}
.ftl-at-nav__home-link {
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    text-decoration: none;
    display: block;
    letter-spacing: .01em;
    text-align: left;
}
.ftl-at-nav__home-link:hover { text-decoration: underline; color: #fff; }

.ftl-at-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ftl-at-nav__item {
    border-bottom: 1px solid #eef1f6;
}
.ftl-at-nav__item:last-child { border-bottom: none; }

/* Toggle button (sezioni con figli) */
.ftl-at-nav__toggle {
    width: 100%;
    background: none !important;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
}
.ftl-at-nav__toggle:hover { background: #f5f8ff !important; }
.ftl-at-nav__toggle--open { background: #f0f5ff !important; }

/* Link sezione principale */
.ftl-at-nav__link {
    display: block;
    padding: 10px 16px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    flex: 1;
    line-height: 1.35;
    text-align: left;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
.ftl-at-nav__link:hover { color: #1a6fb8; background: #f5f8ff; }
.ftl-at-nav__link--active {
    color: #1a6fb8;
    font-weight: 700;
}

/* Freccia accordion */
.ftl-at-nav__arrow {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-right: 12px;
    position: relative;
}
.ftl-at-nav__arrow::before,
.ftl-at-nav__arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 7px;
    height: 1.5px;
    background: #888;
    transition: transform .2s, background .2s;
}
.ftl-at-nav__arrow::before { left: 2px;  transform: translateY(-50%) rotate(45deg); }
.ftl-at-nav__arrow::after  { right: 2px; transform: translateY(-50%) rotate(-45deg); }
.ftl-at-nav__toggle--open .ftl-at-nav__arrow::before { transform: translateY(-50%) rotate(-45deg); background: #1a6fb8; }
.ftl-at-nav__toggle--open .ftl-at-nav__arrow::after  { transform: translateY(-50%) rotate(45deg);  background: #1a6fb8; }

/* Sottomenu */
.ftl-at-nav__sub {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .28s ease;
    background: #f8fafc;
    border-top: 1px solid #eef1f6;
}
.ftl-at-nav__sub--open {
    max-height: 1200px; /* abbastanza grande per qualsiasi numero di voci */
}
.ftl-at-nav__sub-item { border-bottom: 1px solid #eef1f6; }
.ftl-at-nav__sub-item:last-child { border-bottom: none; }

.ftl-at-nav__sub-link {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    padding: 8px 16px 8px 28px;
    color: #445;
    text-decoration: none;
    line-height: 1.35;
    font-size: .82rem;
    text-align: left;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
.ftl-at-nav__sub-link::before {
    content: '–';
    color: #bbb;
    margin-right: 4px;
    flex-shrink: 0;
}
.ftl-at-nav__sub-link:hover { color: #1a6fb8; background: #f5f8ff !important; }
.ftl-at-nav__sub-link--active {
    color: #1a6fb8;
    font-weight: 600;
    background: #eef3ff;
}
.ftl-at-nav__sub-link--active::before { color: #1a6fb8; }

/* Contatore documenti */
.ftl-at-nav__count {
    background: #e0e7ef;
    color: #445;
    border-radius: 20px;
    padding: 1px 6px;
    font-size: .7rem;
    font-weight: 600;
    flex-shrink: 0;
}
.ftl-at-nav__sub-link--active .ftl-at-nav__count,
.ftl-at-nav__link--active .ftl-at-nav__count {
    background: #1a6fb8;
    color: #fff;
}

/* Grid */
.ftl-at-grid { display: grid; gap: 20px; }
.ftl-at-grid--2col { grid-template-columns: repeat(2, 1fr); }
.ftl-at-grid--3col { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 768px) {
    .ftl-at-grid--2col, .ftl-at-grid--3col { grid-template-columns: 1fr; }
}

/* Cards */
.ftl-at-card { background: #fff; border: 1px solid #e0e7ef; border-radius: 8px; padding: 20px; transition: box-shadow .2s; }
.ftl-at-card:hover { box-shadow: 0 4px 16px rgba(26,111,184,.12); }
.ftl-at-card--empty { opacity: .75; }
.ftl-at-card__head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.ftl-at-card__title { margin: 0; font-size: 1rem; font-weight: 600; }
.ftl-at-card__title a { color: #1a6fb8; text-decoration: none; }
.ftl-at-card__title a:hover { text-decoration: underline; }
.ftl-at-card__ref { color: #777; font-size: .8rem; margin: 0 0 8px; }
.ftl-at-card__footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid #eee; font-size: .8rem; color: #888; }
.ftl-at-count { background: #1a6fb8; color: #fff; border-radius: 20px; padding: 1px 7px; font-size: .7rem; margin-left: 4px; }

/* Sottosezioni */
.ftl-at-card__sottosezioni { list-style: none; margin: 0; padding: 0; }
.ftl-at-card__sottosezioni li { padding: 3px 0; }
.ftl-at-card__sottosezioni a { color: #444; font-size: .875rem; text-decoration: none; }
.ftl-at-card__sottosezioni a:hover { color: #1a6fb8; }

/* Badges */
.ftl-at-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; text-decoration: none; }
.ftl-at-badge--obbl { background: #fef3c7; color: #92400e; }
.ftl-at-badge--json { background: #ede9fe; color: #5b21b6; }
.ftl-at-badge--xml  { background: #dcfce7; color: #14532d; }
.ftl-at-badge--checker { background: #dbeafe; color: #1e40af; }

/* Docs list */
.ftl-at-docs-list { display: flex; flex-direction: column; gap: 6px; }
.ftl-at-doc-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f8fafc; border-radius: 6px; border: 1px solid #e8edf5; }
.ftl-at-doc-title { flex: 1; }
.ftl-at-doc-title a { color: #1a6fb8; text-decoration: none; }
.ftl-at-doc-title a:hover { text-decoration: underline; }
.ftl-at-doc-anno { font-size: .8rem; color: #888; white-space: nowrap; }
.ftl-at-doc-format { font-size: .7rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: #e0e7ef; color: #1a2a3a; white-space: nowrap; }
.ftl-at-format--pdf { background: #fee2e2; color: #991b1b; }
.ftl-at-format--xls, .ftl-at-format--xlsx, .ftl-at-format--csv { background: #dcfce7; color: #14532d; }
.ftl-at-format--doc, .ftl-at-format--docx { background: #dbeafe; color: #1e40af; }

.ftl-at-notice, .ftl-at-empty { color: #888; font-style: italic; }
.ftl-at-sezione-title { border-left: 3px solid #1a6fb8; padding-left: 12px; }

/* ── LAYOUT PAGINA SEZIONE (template tassonomia) ─────────────── */
.ftl-at-page-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
    max-width: 1200px;
    margin: 30px auto;
    padding: 24px 16px;
}
@media (max-width: 900px) {
    .ftl-at-page-wrapper { grid-template-columns: 1fr; }
    .ftl-at-page-sidebar { order: 2; }
    .ftl-at-page-main    { order: 1; }
}
.ftl-at-page-sidebar { position: sticky; top: 24px; }
.ftl-at-page-main { min-width: 0; }

/* Breadcrumb */
.ftl-at-breadcrumb { font-size: .82rem; color: #888; margin-bottom: 16px; }
.ftl-at-breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.ftl-at-breadcrumb li + li::before { content: '›'; margin-right: 4px; color: #ccc; }
.ftl-at-breadcrumb a { color: #1a6fb8; text-decoration: none; }
.ftl-at-breadcrumb a:hover { text-decoration: underline; }

/* Titolo e meta */
.ftl-at-page-title { font-size: 1.6rem; margin: 0 0 12px; color: #1a2a3a; }
.ftl-at-page-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; font-size: .82rem; color: #666; }
.ftl-at-page-desc { color: #555; margin-bottom: 20px; }

/* Griglia sottosezioni */
.ftl-at-sottosezioni-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 12px; margin-bottom: 28px; }
.ftl-at-sottosezione-card { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; background: #f0f5ff; border: 1px solid #c3d9f7; border-radius: 8px; text-decoration: none; color: #1a6fb8; font-weight: 500; font-size: .875rem; transition: background .15s; }
.ftl-at-sottosezione-card:hover { background: #dbeafe; }
.ftl-at-sottosezione-card__count { background: #1a6fb8; color: #fff; border-radius: 20px; padding: 1px 7px; font-size: .7rem; white-space: nowrap; }

/* Anno raggruppamento */
.ftl-at-anno-group { font-size: 1rem; color: #1a6fb8; border-bottom: 1px solid #e0e7ef; padding-bottom: 6px; margin: 24px 0 12px; }

/* Documento con contenuto testuale */
.ftl-at-doc-block { margin-bottom: 4px; }
.ftl-at-doc-block--has-content { margin-bottom: 16px; }
.ftl-at-doc-content {
    margin: 8px 0 0 0;
    padding: 12px 16px;
    background: #f8fafc;
    border-left: 3px solid #1a6fb8;
    border-radius: 0 6px 6px 0;
    font-size: .9rem;
    color: #333;
    line-height: 1.6;
}
.ftl-at-doc-content p:first-child { margin-top: 0; }
.ftl-at-doc-content p:last-child  { margin-bottom: 0; }
.ftl-at-doc-content a { color: #1a6fb8; }
.ftl-at-doc-content ul, .ftl-at-doc-content ol { padding-left: 20px; }

/* Contenuto testuale della sezione (da term_meta WYSIWYG) */
.ftl-at-sezione-content {
    margin-bottom: 28px;
    padding: 20px 24px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e0e7ef;
    font-size: .95rem;
    line-height: 1.7;
    color: #333;
}
.ftl-at-sezione-content p:first-child { margin-top: 0; }
.ftl-at-sezione-content p:last-child  { margin-bottom: 0; }
.ftl-at-sezione-content a   { color: #1a6fb8; }
.ftl-at-sezione-content h2,
.ftl-at-sezione-content h3  { color: #1a2a3a; margin-top: 1.2em; }
.ftl-at-sezione-content ul,
.ftl-at-sezione-content ol  { padding-left: 20px; }
.ftl-at-sezione-content table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ftl-at-sezione-content th  { background: #eef2ff; padding: 8px 12px; text-align: left; border: 1px solid #dde3f0; }
.ftl-at-sezione-content td  { padding: 8px 12px; border: 1px solid #e0e7ef; }
.ftl-at-sezione-content tr:nth-child(even) td { background: #f8fafc; }

/* Override hover rosa del tema sul menu AT */
.ftl-at-nav .ftl-at-nav__toggle:hover,
.ftl-at-nav a.ftl-at-nav__link:hover,
.ftl-at-nav a.ftl-at-nav__sub-link:hover {
    background-color: #f5f8ff !important;
    color: #1a6fb8 !important;
}
