/* public/styles/normativa.css */
/* Studio Editorial Paper + Academic Teal (#0E7490) */

:root {
    --teal-700: #0e7490;
    --teal-800: #155e75;
    --teal-50: #ecfeff;
    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-500: #64748b;
    --paper: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--paper);
    color: var(--ink-900);
    min-height: 100vh;
}

.norm-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.norm-topbar-inner {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.norm-brand-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.norm-school-logo-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    flex-shrink: 0;
}

.norm-school-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.norm-eyebrow {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--teal-700);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.norm-school-title {
    margin: 0.1rem 0 0 0;
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--ink-900);
    line-height: 1.25;
}

.norm-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.norm-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--teal-50);
    color: var(--teal-700);
    border: 1px solid #a5f3fc;
    font-size: 0.76rem;
    font-weight: 800;
    padding: 0.32rem 0.75rem;
    border-radius: 999px;
}

.norm-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #cbd5e1;
    background: var(--white);
    color: var(--ink-900);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.42rem 0.82rem;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
}

.norm-btn-secondary:hover {
    background: #f1f5f9;
}

.norm-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--teal-700);
    background: var(--teal-700);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
}

.norm-btn-primary:hover {
    background: var(--teal-800);
}

.norm-shell {
    max-width: 1220px;
    margin: 0 auto;
    padding: 1.15rem 1.25rem 2rem 1.25rem;
}

.norm-controls-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.norm-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.norm-search-box {
    position: relative;
    flex: 1 1 260px;
}

.norm-search-box i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
}

.norm-search-box input {
    width: 100%;
    padding: 0.58rem 0.85rem 0.58rem 2.3rem;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    font-size: 0.88rem;
    color: var(--ink-900);
    background: var(--paper);
}

.norm-search-box input:focus {
    outline: none;
    border-color: var(--teal-700);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

.norm-grade-context {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.norm-grade-context button {
    border: none;
    background: #ffffff;
    color: #3730a3;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
}

.norm-category-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.norm-cat-pill {
    border: 1px solid var(--border);
    background: var(--paper);
    color: var(--ink-700);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.36rem 0.8rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.norm-cat-pill:hover {
    border-color: #a5f3fc;
    color: var(--teal-700);
}

.norm-cat-pill.active {
    background: var(--teal-700);
    border-color: var(--teal-700);
    color: var(--white);
}

.norm-workspace {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1rem;
    align-items: start;
}

.norm-list-pane {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.norm-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--ink-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.norm-list-header strong {
    background: var(--teal-50);
    color: var(--teal-700);
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
}

.norm-documents-list {
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    overflow-y: auto;
}

.norm-doc-item {
    border: none;
    border-bottom: 1px solid #f1f5f9;
    background: var(--white);
    text-align: left;
    padding: 0.95rem 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    transition: background 0.15s ease;
}

.norm-doc-item:hover {
    background: #f8fafc;
}

.norm-doc-item.is-selected {
    background: #f0fdfa;
    border-left: 4px solid var(--teal-700);
}

.norm-doc-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.norm-doc-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.16rem 0.52rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.norm-doc-version {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-500);
}

.norm-doc-item-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--ink-900);
    line-height: 1.3;
}

.norm-doc-item-summary {
    font-size: 0.78rem;
    color: var(--ink-500);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.norm-reader-pane {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    min-height: 520px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.norm-reader-mobile-bar {
    display: none;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.norm-reader-empty {
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--ink-500);
}

.norm-empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.9rem auto;
    border-radius: 16px;
    background: var(--teal-50);
    color: var(--teal-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
}

.norm-reader-empty h2 {
    margin: 0 0 0.4rem 0;
    font-size: 1.1rem;
    color: var(--ink-900);
}

.norm-reader-empty p {
    margin: 0 auto;
    max-width: 440px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.norm-article-header {
    padding: 1.35rem 1.75rem 1rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.norm-article-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.norm-article-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.38rem;
    font-weight: 800;
    color: var(--ink-900);
    line-height: 1.25;
}

.norm-article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--ink-500);
}

.norm-article-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.norm-article-body {
    padding: 1.5rem 1.85rem 2.25rem 1.85rem;
    max-width: 72ch;
    font-size: 1rem;
    line-height: 1.72;
    color: #1e293b;
}

.norm-article-body h1,
.norm-article-body h2,
.norm-article-body h3 {
    color: var(--ink-900);
    margin: 1.25rem 0 0.5rem 0;
    line-height: 1.3;
}

.norm-article-body ul,
.norm-article-body ol {
    padding-left: 1.35rem;
}

.norm-article-body li {
    margin-bottom: 0.35rem;
}

.norm-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.88rem;
    display: block;
    overflow-x: auto;
}

.norm-article-body th,
.norm-article-body td {
    border: 1px solid #cbd5e1;
    padding: 0.5rem 0.7rem;
    text-align: left;
}

.norm-article-body th {
    background: #f8fafc;
    font-weight: 700;
}

.norm-pdf-frame {
    width: 100%;
    height: 70vh;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
}

@media (max-width: 900px) {
    .norm-workspace {
        grid-template-columns: 1fr;
    }

    .norm-documents-list {
        max-height: none;
    }

    .norm-workspace.is-reading .norm-list-pane {
        display: none;
    }

    .norm-workspace:not(.is-reading) .norm-reader-pane {
        display: none;
    }

    .norm-reader-mobile-bar {
        display: flex;
    }

    .norm-article-header,
    .norm-article-body {
        padding-left: 1.15rem;
        padding-right: 1.15rem;
    }
}

@media print {
    .no-print {
        display: none !important;
    }
    body {
        background: #ffffff;
    }
    .norm-workspace {
        display: block;
    }
    .norm-reader-pane {
        border: none;
        box-shadow: none;
    }
}
