/* ==========================================================================
   CNPP Portal Legislativo — Componentes Jurídicos, Tarjetas y Herramientas
   ========================================================================== */

/* Sidebar Cards */
.sidebar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: var(--shadow-sm);
}

.sidebar-card-title {
    margin: 0 0 11px;
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--brand-dark);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 7px;
}

.sidebar-search-form {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    position: relative;
}

.sidebar-search-form input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

.sidebar-search-form button {
    padding: 7px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--brand-primary);
    color: #FFFFFF;
    font-weight: 700;
    cursor: pointer;
}

.sidebar-quick-links {
    display: flex;
    flex-direction: column;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-quick-links a {
    display: block;
    padding: 6px 9px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-page);
}

.sidebar-quick-links a:hover {
    background: var(--bg-subtle);
    color: var(--brand-dark);
}

.nav-book-group {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
}

.nav-book-summary {
    padding: 9px 11px;
    background: var(--bg-page);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--brand-dark);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-book-summary small {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.nav-title-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-title-link {
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.83rem;
    color: var(--text-main);
}

.nav-title-link:hover,
.nav-title-link.is-current {
    background: var(--bg-subtle);
}

.nav-title-link.is-current {
    border-left: 3px solid var(--brand-primary);
    font-weight: 700;
}

.nav-title-label {
    color: var(--brand-primary);
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
}

.sidebar-article-list,
.sidebar-guide-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-article-list a,
.sidebar-guide-list a {
    display: block;
    text-decoration: none;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    background: var(--bg-page);
    color: var(--text-main);
    font-size: 0.86rem;
}

.sidebar-article-list a strong {
    color: var(--brand-primary);
    display: block;
}

.sidebar-article-list a span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Badges & Pills */
.status-vigente,
.status-derogado,
.badge-gold,
.section-label-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
}

.status-vigente {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.status-derogado {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.badge-gold {
    background: var(--warn-bg);
    color: var(--warn-text);
    border: 1px solid var(--warn-border);
}

.section-label-tag {
    background: var(--bg-subtle);
    color: var(--brand-dark);
    border: 1px solid var(--border-subtle);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.72rem;
}

/* Hero & Page Headers */
.page-hero-card,
.editorial-box,
.legal-document-box,
.aeo-answer-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.page-hero-card h1,
.article-page-header h1 {
    margin: 6px 0 10px;
    font-size: clamp(1.55rem, 2.5vw, 2.05rem);
    line-height: 1.2;
    color: var(--brand-dark);
}

.hero-subtitle {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 1.04rem;
}

.ficha-tecnica-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.ficha-item {
    background: var(--bg-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.ficha-item span {
    display: block;
    font-size: 0.76rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.ficha-item strong {
    display: block;
    font-size: 0.94rem;
    color: var(--brand-dark);
    margin-top: 2px;
}

.aeo-answer-box {
    background: var(--accent-gold-soft);
    border: 1px solid var(--warn-border);
    border-left: 5px solid var(--accent-gold);
}

.aeo-answer-box h2 {
    margin: 0 0 8px;
    font-size: 1.12rem;
    color: var(--brand-dark);
}

.hero-search-box {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    position: relative;
}

.hero-search-box input {
    flex: 1 1 auto;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    min-height: 46px;
}

.hero-search-box button {
    padding: 12px 22px;
    background: var(--brand-primary);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    min-height: 46px;
}

.hero-search-box button:hover {
    background: var(--brand-dark);
}

.quick-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.btn-primary,
.btn-secondary,
.btn-outline-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    min-height: 40px;
}

.btn-primary {
    background: var(--brand-primary);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--brand-dark);
    color: #FFFFFF;
}

.btn-secondary {
    background: var(--bg-subtle);
    color: var(--brand-dark);
    border-color: var(--border-strong);
}

.btn-outline-sm {
    padding: 6px 12px;
    min-height: 36px;
    font-size: 0.84rem;
    background: var(--bg-surface);
    color: var(--brand-primary);
    border-color: var(--border-strong);
}

.btn-outline-sm:hover,
.btn-secondary:hover {
    background: var(--bg-page);
    border-color: var(--brand-primary);
}

/* Official Normative Document Styling vs Editorial Styling */
.legal-document-box {
    border-left: 5px solid var(--brand-primary);
    max-width: 100%;
}

.legal-document-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.legal-body {
    max-width: 820px;
    font-family: var(--font-serif);
    font-size: var(--legal-font-size);
    line-height: var(--legal-line-height);
    color: var(--text-main);
}

.legal-body p {
    margin: 0 0 14px;
}

.cnpp-official-title {
    margin: 0 0 14px;
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.cnpp-frac {
    padding-left: 14px;
    border-left: 2px solid var(--border-subtle);
}

.cnpp-inciso {
    padding-left: 28px;
}

.cnpp-apartado {
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--brand-dark);
    margin-top: 16px;
}

.cnpp-nota-reforma {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-style: italic;
    color: var(--text-muted);
    background: var(--bg-page);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.lft-crossref {
    color: var(--brand-primary);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.invalidity-alert {
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-left: 5px solid #B7791F;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-family: var(--font-sans);
    font-size: 0.94rem;
}

.editorial-box {
    background: var(--bg-editorial);
}

.editorial-box h2 {
    margin: 0 0 12px;
    font-size: 1.24rem;
    color: var(--brand-dark);
}

/* Topic Cards, Featured Articles & Structural TOC */
.cards-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.cards-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.topic-card,
.article-mini-card,
.guide-card,
.decision-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.topic-card a,
.article-mini-card,
.guide-card a {
    text-decoration: none;
}

.article-mini-card {
    color: var(--text-main);
    transition: border-color 0.15s ease, transform 0.12s ease;
}

.article-mini-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

.article-mini-num {
    font-weight: 700;
    color: var(--brand-primary);
    font-size: 0.96rem;
}

.article-mini-head {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.toc-book-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 16px;
}

.toc-book-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--brand-primary);
    padding-bottom: 8px;
}

.toc-title-details {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    background: var(--bg-page);
}

.toc-title-summary {
    padding: 11px 14px;
    cursor: pointer;
    font-weight: 700;
    color: var(--brand-dark);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.toc-title-body {
    padding: 14px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
}

.toc-chapter-block {
    margin-bottom: 16px;
}

.toc-chapter-title {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--brand-secondary);
}

.toc-article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 7px;
}

.toc-article-pill {
    display: block;
    padding: 7px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-page);
    text-decoration: none;
    font-size: 0.84rem;
    color: var(--text-main);
}

.toc-article-pill:hover {
    border-color: var(--brand-primary);
    background: var(--bg-subtle);
}

.toc-article-pill strong {
    color: var(--brand-primary);
}

/* Article Action Toolbar & Citations */
.article-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.citation-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 14px;
}

.citation-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.citation-tab-btn {
    padding: 6px 11px;
    border: 1px solid var(--border-strong);
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.84rem;
    font-family: inherit;
}

.citation-tab-btn.is-active {
    background: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
}

.citation-output {
    background: var(--bg-page);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    font-size: 0.9rem;
    margin: 0 0 8px;
}

/* Sequential Nav */
.article-seq-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: stretch;
    margin: 22px 0;
}

.seq-link,
.seq-index-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-decoration: none;
    height: 100%;
}

.seq-link:hover,
.seq-index-btn:hover {
    border-color: var(--brand-primary);
}

.seq-dir {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
}

.seq-disabled {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: var(--text-muted);
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    height: 100%;
    font-size: 0.86rem;
}

/* Related Grids & External Chips */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.related-panel h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--brand-dark);
}

.compact-link-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chip-link,
.chip-static {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    max-width: 310px;
}

.chip-link span {
    font-size: 0.77rem;
    color: var(--text-muted);
}

/* Procedural Map SVG & Interactive Panel */
.proc-map-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    margin: 18px 0;
}

.proc-svg-scroll {
    overflow-x: auto;
    margin-bottom: 16px;
}

.proc-stage-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.proc-stage-btn {
    padding: 8px 13px;
    border: 1px solid var(--border-strong);
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: inherit;
}

.proc-stage-btn.is-active {
    background: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
}

.proc-stage-detail {
    background: var(--bg-editorial);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--accent-gold);
    border-radius: var(--radius-sm);
    padding: 16px;
}

/* Comparator & Diff */
.diff-added {
    background: #DCFCE7;
    color: #14532D;
    text-decoration: underline;
    padding: 1px 2px;
}

.diff-removed {
    background: #FEE2E2;
    color: #7F1D1D;
    text-decoration: line-through;
    padding: 1px 2px;
}

.parallel-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

/* Tables & Forms */
.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    background: var(--bg-surface);
}

.legal-table th,
.legal-table td {
    border: 1px solid var(--border-subtle);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.legal-table th {
    background: var(--bg-subtle);
    color: var(--brand-dark);
    font-weight: 700;
}

.table-scroll {
    overflow-x: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field label {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--brand-dark);
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.94rem;
    background: var(--bg-surface);
    color: var(--text-main);
}

/* FAQ Accordion */
.faq-list details {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    margin-bottom: 10px;
}

.faq-list summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--brand-dark);
}

.faq-list details p {
    margin: 10px 0 0;
}

/* Search Suggestions Dropdown */
.cnpp-suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 950;
    background: var(--bg-surface);
    border: 1px solid var(--brand-primary);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 360px;
    overflow-y: auto;
    list-style: none;
    margin: 2px 0 0;
    padding: 4px 0;
}

.cnpp-suggest-item a {
    display: block;
    padding: 9px 12px;
    text-decoration: none;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-subtle);
}

.cnpp-suggest-item a:hover,
.cnpp-suggest-item.is-selected a {
    background: var(--bg-subtle);
}

/* AdSense Reserved Container (CLS = 0) */
.cnpp-ad-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px;
    text-align: center;
    margin-bottom: 16px;
}

.cnpp-ad-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.cnpp-ad-slot {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-main > .cnpp-ad-container .cnpp-ad-slot {
    min-height: 100px;
}

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

.muted-small {
    font-size: 0.85rem;
}

.d-block {
    display: block;
}

.toast-msg {
    display: inline-block;
    margin-left: 8px;
    color: var(--success-text);
    font-weight: 700;
    font-size: 0.88rem;
}

.eeat-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.eeat-meta-grid dt {
    font-size: 0.76rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.eeat-meta-grid dd {
    margin: 2px 0 0;
    font-size: 0.9rem;
}

.eeat-disclaimer {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.86rem;
    color: var(--text-muted);
}
