/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

:root {
    /* Brand Colors */
    --darkblue: #003470;
    --aqua: #0CF3AE;
    --blue: #1FAAFF;
    --red: #fc6655;
    --yellow: #ffc14f;
    --lightgrey: #f7f9fb;
    
    /* Application Colors */
    --primary-color: var(--darkblue);
    --accent-color: var(--aqua);
    --link-color: var(--blue);
    --text-color: #2c3e50;
    --text-light: #6b7280;
    --border-color: #e2e8f0;
    --bg-color: #ffffff;
    --sidebar-bg: var(--lightgrey);
    --hover-bg: #f0f4f8;
    --highlight-color: var(--yellow);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--lightgrey);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Desktop: body should not scroll, content areas do */
@media (min-width: 769px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
}

/* Mobile: allow body scroll unless menu is open */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        max-width: 100vw;
    }
    
    body.mobile-menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

/* Header */
.site-header {
    background: var(--bg-color);
    border-bottom: 3px solid var(--primary-color);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 52, 112, 0.08);
    flex-shrink: 0;
}

.header-content {
    max-width: 1580px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
}

.select-footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 0 1rem;
}
.toc-footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 0 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.site-title a {
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.site-title svg {
    width: 20px;
    height: 20px;
    display: block;
}


.regulation-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
}

.regulation-switcher label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
    line-height: 1;
    display: flex;
    align-items: center;
}

.regulation-switcher select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    background: var(--bg-color);
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.2s ease;
    line-height: 1;
    height: auto;
}

.regulation-switcher select:hover {
    border-color: var(--link-color);
}

.regulation-switcher select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 52, 112, 0.1);
}

/* View Mode Toggle */
.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--lightgrey);
    border-radius: 6px;
}

.mode-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.mode-btn:hover {
    color: var(--text-color);
    text-decoration: none;
}

.mode-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}


/* Main Content */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    flex: 1;
    width: 100%;
}

/* Desktop: main-content doesn't scroll, inner areas do */
@media (min-width: 769px) {
    .main-content {
        overflow: hidden;
    }
}

/* Mobile: main-content allows normal flow */
@media (max-width: 768px) {
    .main-content {
        overflow-x: hidden;
        overflow-y: visible;
        max-width: 100vw;
    }
}

.layout-container {
    display: flex;
    align-items: flex-start;
}

/* Desktop: fixed height layout with scrollable inner areas */
@media (min-width: 769px) {
    .layout-container {
        height: 100%;
    }
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-color);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100%;
    overflow-y: auto;
    align-self: flex-start;
}

.sidebar-content {
    padding: 1.5rem;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--lightgrey);
}

.sidebar h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.toc-controls {
    display: flex;
    gap: 0.25rem;
}

.toc-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
    background: var(--lightgrey);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.toc-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.toc-btn:active {
    transform: translateY(1px);
}

/* Search Box */
.search-box {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

#search-input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--lightgrey);
    color: var(--text-color);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#search-input::placeholder {
    color: var(--text-light);
}

#search-input:focus {
    outline: none;
    border-color: var(--link-color);
    background: var(--bg-color);
    box-shadow: 0 0 0 3px rgba(31, 170, 255, 0.1);
}

.search-button-container {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.search-button,
.clear-search-button {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 4px;
    background: var(--lightgrey);
    color: white;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
}

.search-button:hover,
.clear-search-button:hover {
    background: #0d7acc;
    transform: scale(1.05);
}

.search-button:active,
.clear-search-button:active {
    transform: scale(0.98);
}

.clear-search-button {
    background: #999;
    font-size: 1.2rem;
    padding: 0.25rem;
    display: none;
}

.clear-search-button:hover {
    background: #777;
}

/* Search Results Modal */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal[hidden] {
    display: none;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.search-modal-box {
    position: relative;
    background: var(--bg-color);
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    width: min(680px, 95vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--lightgrey);
    flex-shrink: 0;
}

.search-modal-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
}

.search-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.search-modal-close:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.search-modal-body {
    overflow-y: auto;
    flex: 1;
}

/* Results inside modal */
.results-summary {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-color);
    background: var(--lightgrey);
    margin: 0;
}

.no-results {
    padding: 2rem 1rem;
    margin: 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

.search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-result-item {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--lightgrey);
}

.result-link {
    display: block;
    padding: 0.75rem 1rem;
    color: inherit;
    text-decoration: none;
}

.result-link:hover .result-title {
    color: var(--link-color);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.result-type {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--link-color);
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    min-width: 45px;
    text-align: center;
    flex-shrink: 0;
}

.result-title {
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    transition: color 0.15s;
}

.result-matches {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #e8f1ff;
    color: var(--link-color);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.result-snippet {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.5;
    font-style: italic;
}

.search-result-item.annex .result-type {
    background: #9b59b6;
}

/* Full Text View Search Box */
.fulltext-search-box {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
    padding: 1.15rem 0.75rem 0.95rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.75rem;
}

/* Table of Contents */
.toc {
    font-size: 0.875rem;
}

.toc-chapter {
    margin-bottom: 0.75rem;
}

.toc-chapter-title {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: all 0.2s ease;
    background: var(--lightgrey);
}

.toc-chapter-title:hover {
    background-color: var(--hover-bg);
    border-left: 3px solid var(--link-color);
    padding-left: calc(0.6rem - 3px);
}

.toc-chapter-title-text {
    flex: 1;
}

.toc-title-icons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-table-icon {
    font-size: 0.9rem;
    color: var(--link-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    transition: all 0.2s;
    opacity: 0;
}

.toc-chapter-title:hover .toc-table-icon,
.toc-section-title:hover .toc-table-icon {
    opacity: 0.8;
}

.toc-table-icon:hover {
    opacity: 1 !important;
    background: rgba(31, 170, 255, 0.15);
    transform: scale(1.1);
}

.toc-chapter-icon {
    font-size: 0.75rem;
    transition: transform 0.2s;
    color: var(--link-color);
}

.toc-chapter.collapsed .toc-chapter-icon {
    transform: rotate(-90deg);
}

.toc-chapter.collapsed .toc-chapter-content {
    display: none;
}

.toc-chapter-number {
    font-weight: normal;
    color: var(--text-light);
}

.toc-chapter-subtitle {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
}

/* Annexes in TOC */
.toc-annexes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.toc-annexes .toc-chapter-number {
    font-weight: 600;
    color: var(--primary-color);
}

.toc-section {
    margin-bottom: 0.5rem;
}

.toc-section-title {
    margin-bottom: 0.15rem;
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    padding-left: 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: all 0.2s ease;
}

.toc-section-title:hover {
    background-color: var(--hover-bg);
    border-left: 2px solid var(--aqua);
    padding-left: calc(1rem - 2px);
}

.toc-section-title-text {
    flex: 1;
}

.toc-section-number {
    font-weight: normal;
    color: var(--text-light);
}

.toc-section-name {
    font-weight: 600;
    color: var(--text-color);
}

.toc-section-icon {
    font-size: 0.7rem;
    transition: transform 0.2s;
    color: var(--link-color);
}

.toc-section.collapsed .toc-section-icon {
    transform: rotate(-90deg);
}

.toc-section.collapsed .toc-section-content {
    display: none;
}

.toc-articles {
    list-style: none;
}

.toc-section .toc-articles {
    padding-left: 1rem;
}

.toc-articles li {
    margin-bottom: 0.15rem;
}

.toc-articles a {
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.toc-articles a:hover {
    background-color: var(--hover-bg);
    text-decoration: none;
    transform: translateX(2px);
}

.toc-articles li.active a {
    color: var(--text-color);
    font-weight: 500;
    border: 2px solid var(--link-color);
}

.toc-articles .article-number {
    font-weight: normal;
    color: var(--text-light);
}

.toc-articles .article-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.toc-articles li.active .article-number {
    color: var(--link-color);
    font-weight: 700;
}

.toc-articles li.active .article-title {
    color: var(--text-color);
    font-weight: 600;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 1000px;
    background: var(--bg-color);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    height: 100%;
}

/* Recent Articles Panel */
.recent-panel {
    width: 280px;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100%;
    overflow-y: auto;
    align-self: flex-start;
    flex-shrink: 0;
}

.recent-panel-content {
    padding: 1.5rem;
}

.recent-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--lightgrey);
}

.recent-panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.recent-clear-all {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.25rem;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.recent-clear-all:hover {
    color: var(--red);
    opacity: 1;
    transform: scale(1.15);
}

.recent-articles-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recent-empty {
    color: var(--text-light);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0;
    font-style: italic;
}

.recent-article-item {
    display: block;
    padding: 0.75rem;
    padding-right: 0.75rem;
    background: var(--lightgrey);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
}

.recent-article-item.pinned {
    background: #fff9e6;
    border-color: var(--yellow);
    box-shadow: 0 1px 3px rgba(255, 193, 79, 0.2);
}

.recent-article-item.pinned:hover {
    background: #fff5d6;
    border-color: var(--yellow);
    box-shadow: 0 2px 8px rgba(255, 193, 79, 0.3);
}

.recent-article-item:hover {
    background: var(--hover-bg);
    border-color: var(--link-color);
    transform: translateX(-2px);
    box-shadow: 0 2px 8px rgba(31, 170, 255, 0.1);
}

.recent-article-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    z-index: 10;
}

.recent-article-pin,
.recent-article-delete {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.15rem 0.35rem;
    line-height: 1;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    font-weight: normal;
}

.recent-article-delete {
    font-size: 1.1rem;
    font-weight: 300;
}

.recent-article-item:hover .recent-article-pin,
.recent-article-item:hover .recent-article-delete {
    opacity: 1;
}

.recent-article-pin.pinned {
    opacity: 1;
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--primary-color);
}

.recent-article-pin:hover {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--primary-color);
    transform: scale(1.1);
}

.recent-article-delete:hover {
    background: var(--red);
    border-color: var(--red);
    color: white;
    transform: scale(1.1);
}

.recent-article-number {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding-right: 3rem;
}

.recent-article-title {
    display: block;
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    padding-right: 3rem;
}

.recent-article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-light);
}

.recent-article-reg {
    font-weight: 600;
    text-transform: uppercase;
}

.recent-article-time {
    font-style: italic;
}

/* Article Navigation */
.article-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--lightgrey);
}

.nav-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    flex-shrink: 0;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--lightgrey);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
    font-weight: 500;
}

.nav-btn:hover {
    border-color: var(--link-color);
    background: var(--bg-color);
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(31, 170, 255, 0.2);
}

.nav-spacer {
    flex: 0 0 auto;
}

.nav-arrow {
    font-size: 1rem;
    color: var(--link-color);
}

.nav-btn:hover .nav-arrow {
    color: var(--primary-color);
}

.nav-label {
    color: var(--text-color);
}

.article-content {
    margin-bottom: 3rem;
}

.article-heading {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
    border-left: 4px solid var(--aqua);
    padding-left: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.article-heading-text {
    flex: 1;
}

.copy-article-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-light);
    flex-shrink: 0;
    height: 36px;
    width: 36px;
}

.copy-article-btn:hover {
    background: var(--hover-bg);
    border-color: var(--link-color);
    color: var(--link-color);
}

.copy-article-btn:active {
    transform: scale(0.95);
}

.copy-article-btn.copied {
    background: var(--aqua);
    border-color: var(--aqua);
    color: var(--darkblue);
}

.copy-article-btn svg {
    width: 18px;
    height: 18px;
}

.article-title-heading {
    display: block;
    font-size: 1.15rem;
    font-weight: normal;
    color: var(--text-light);
    margin-top: 0.5rem;
    border-left: none;
    padding-left: 0;
}

.article-body {
    line-height: 1.8;
}

.article-body p {
    margin-bottom: 1rem;
}

.article-body strong {
    font-weight: 600;
}

.article-body em {
    font-style: italic;
}

/* Defined Terms */
.defined-term {
    border-bottom: 2px dotted var(--link-color);
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.defined-term:hover {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.defined-term:active {
    background-color: rgba(31, 170, 255, 0.1);
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

/* Definition Tooltip */
.definition-tooltip {
    position: absolute;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 52, 112, 0.4);
    z-index: 1000;
    max-width: 400px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    border: 2px solid var(--aqua);
}

.definition-tooltip.visible {
    opacity: 1;
    pointer-events: auto;
}

.definition-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--aqua);
}

.tooltip-term {
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
    color: var(--aqua);
    user-select: text;
}

.tooltip-definition {
    font-size: 0.8rem;
    line-height: 1.5;
    color: white;
    user-select: text;
    cursor: text;
}

/* Lists */
.fmx-list {
    margin: 1rem 0 1rem 1.5rem;
}

.fmx-list-decimal {
    list-style-type: decimal;
}

.fmx-list-lower-alpha {
    list-style-type: lower-alpha;
}

.fmx-list-disc {
    list-style-type: disc;
}

.fmx-list-item {
    margin-bottom: 0.5rem;
}

/* Hide browser's default list markers when custom markers are present */
.fmx-list-item[data-marker] {
    list-style-type: none;
    display: flex;
    margin-left: -1.5rem;
}

.fmx-list-item-num {
    min-width: 3rem;
    font-weight: 600;
    flex-shrink: 0;
}

.fmx-list-item-body {
    flex: 1;
}

/* Numbered blocks */
.fmx-numbered-block {
    display: flex;
    margin-bottom: 1rem;
}

.fmx-numbered-block-num {
    min-width: 3rem;
    font-weight: 600;
}

.fmx-numbered-block-body {
    flex: 1;
}

/* ── Formex Tables ──────────────────────────────── */
.fmx-section {
    margin-bottom: 2rem;
}

.fmx-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.75rem;
    color: var(--text-color);
}

.fmx-section-subtitle {
    font-weight: 400;
    color: var(--text-light);
}

.fmx-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 1.25rem 0;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.fmx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    line-height: 1.45;
}

.fmx-table thead th {
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.fmx-table thead th:last-child {
    border-right: none;
}

.fmx-table tbody tr:nth-child(odd) {
    background-color: var(--bg-color);
}

.fmx-table tbody tr:nth-child(even) {
    background-color: var(--lightgrey);
}

.fmx-table tbody tr:hover {
    background-color: var(--lightgrey);
}

.fmx-table td,
.fmx-table th {
    padding: 0.45rem 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.fmx-table td:last-child,
.fmx-table th:last-child {
    border-right: none;
}

.fmx-table-notes {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Search highlighting */
.search-highlight,
mark.search-highlight {
    background-color: #ffe5b4;
    color: #000;
    padding: 0.125rem 0.25rem;
    border-radius: 2px;
    font-weight: 500;
}

/* Error and Select Pages */
.error-page,
.select-page {
    padding: 3rem;
    text-align: center;
    background: var(--bg-color);
    min-height: calc(100vh - 200px);
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.error-page h2,
.select-page h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.select-page h2::before {
    font-size: 2.5rem;
}

.select-hero {
    margin-bottom: 3rem;
}

.select-subtitle {
    color: var(--text-light);
    font-size: 1.15rem;
    margin-top: 0.75rem;
    font-weight: 400;
    line-height: 1.6;
}

.regulation-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 3rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.regulation-card {
    border: 1px solid rgba(0, 52, 112, 0.12);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: relative;
    overflow: hidden;
}

.regulation-card-main {
    flex: 1;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.regulation-card-header {
    flex: 0 0 280px;
    text-align: left;
}

.regulation-card-dates {
    flex: 1;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.regulation-card:hover {
    border-color: rgba(31, 170, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 52, 112, 0.1);
}

.regulation-card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.regulation-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.4rem;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.regulation-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e40af;
    background: white;
    
    display: inline-block;
    margin-bottom: 0.4rem;
}

.regulation-card p {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 0;
    line-height: 1.6;
}

.regulation-celex {
    margin-top: 0.25rem;
}

.regulation-date-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: white;
}

.date-force {
    /* border-left: 3px solid #f97316;*/
}

.date-applies {
    /* border-left: 3px solid #10b981; */
}

.date-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.date-force .date-icon {
    
}

.date-applies .date-icon {
    
}

.date-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    text-align: center;
    align-items: center;
}

.date-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.date-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.button {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 52, 112, 0.15);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.button:hover {
    text-decoration: none;
    background: #004a94;
    box-shadow: 0 2px 6px rgba(0, 52, 112, 0.25);
    color: white;
}

.button:hover::before {
    left: 100%;
}

.button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 52, 112, 0.2);
}

/* Footer */
.site-footer {
    background: var(--bg-color);
    border-top: 3px solid var(--primary-color);
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-light);
    box-shadow: 0 -2px 8px rgba(0, 52, 112, 0.08);
}

.site-footer a {
    color: var(--link-color);
    font-weight: 600;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: var(--primary-color);
}

/* Hamburger Menu Button */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    transition: transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-menu:hover {
    transform: scale(1.1);
}

.hamburger-menu:active {
    transform: scale(0.95);
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover states on touch devices */
    .toc-articles a:hover,
    .toc-chapter-title:hover,
    .toc-section-title:hover {
        transform: none;
    }
    
    /* Add active states for touch feedback */
    .toc-articles a:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
    
    .hamburger-menu:active {
        opacity: 0.7;
    }
}

/* Full Text View */
.fulltext-container {
    display: flex;
    height: calc(100vh - 60px);
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

.fulltext-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem 3rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.fulltext-content * {
    box-sizing: border-box;
    max-width: 100%;
}

.fulltext-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.fulltext-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.fulltext-body {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    overflow-x: hidden;
}

.fulltext-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-margin-top: 80px; /* Offset for fixed header */
    overflow-x: hidden;
}

.section-content {
    line-height: 1.7;
}

.section-heading-major {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 2rem 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.section-subtitle {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    margin-top: 0.5rem;
}

/* Preamble section */
.preamble-section {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.preamble-init {
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.preamble-visas {
    margin-bottom: 1.5rem;
}

.preamble-visa {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.preamble-note {
    display: block;
    margin-left: 2rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

.preamble-formula {
    margin-top: 1.5rem;
}

.preamble-enact {
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* Recitals section */
.recital-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.recital-number {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text-light);
    min-width: 2.5rem;
}

.recital-text {
    flex: 1;
}

/* Enacting section */
.enacting-section {
    /* Full regulation content with all articles, chapters, sections */
}

/* Annex section */
.annex-section {
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    scroll-margin-top: 80px; /* Offset for fixed header */
}

/* Full text rendered elements */
.section-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.section-content strong {
    font-weight: 600;
}

.section-content em {
    font-style: italic;
}

/* Structural elements in full text */
.fulltext-division {
    margin-bottom: 2rem;
}

.enacting-terms {
    /* Container for all enacting terms */
}

.annex-content {
    /* Container for annex content - same styling as articles in browse mode */
}

.annex-content .article-body {
    /* Annex body styling inherits article body styles */
}

/* Article styling within full text */
.section-content .fulltext-article {
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.section-content .fulltext-article:last-child {
    border-bottom: none;
}

.section-content .article-heading,
.section-content h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 1rem 0;
}

.section-content .article-title-sub {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 0.25rem;
}

.section-content .oj-sti-art {
    font-weight: 600;
    color: var(--text-color);
    margin-top: 0.25rem;
}

.section-content .chapter-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 2rem 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.section-content .chapter-subtitle {
    display: block;
    font-size: 1.25rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.section-content .section-heading {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 1.5rem 0 1rem 0;
}

.fulltext-chapter {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.chapter-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.chapter-subtitle {
    display: block;
    font-size: 1.25rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.fulltext-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-margin-top: 80px; /* Offset for fixed header */
}

.section-heading {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    padding: 0.75rem 0;
}

.fulltext-article {
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.fulltext-article:last-child {
    border-bottom: none;
}

.fulltext-article .article-heading {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 1rem 0;
}

.fulltext-article .article-title-sub {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 0.25rem;
}

.fulltext-article .article-body {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Show hamburger menu */
    .hamburger-menu {
        display: flex;
    }
    
    /* Mobile header adjustments */
    .site-header {
        padding: 1rem 1.5rem;
    }
    
    .header-content {
        height: auto;
        gap: 0;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 1rem;
        width: 100%;
    }
    
    .hamburger-menu {
        width: 32px;
        height: 28px;
    }
    
    .hamburger-line {
        height: 3px;
        border-radius: 2px;
    }
    
    .site-title {
        font-size: 1.1rem;
        flex: 1;
    }
    
    .site-title a {
        padding-left: 0;
    }
    
    /* Hide desktop regulation switcher on mobile */
    .header-right {
        display: none;
    }
    
    /* Show header-right on mobile for fulltext view - will be controlled by JS or body class */
    body.fulltext-view .header-right {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        gap: 1rem;
        z-index: 900;
    }
    
    body.fulltext-view .view-mode-toggle {
        width: 100%;
    }
    
    body.fulltext-view .regulation-switcher {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    body.fulltext-view .regulation-switcher select {
        width: 100%;
    }
    
    body.fulltext-view .fulltext-content {
        padding-top: calc(2rem + 120px);
    }
    
    /* Hide hamburger in fulltext view on mobile */
    body.fulltext-view .hamburger-menu {
        display: none;
    }
    
    /* Full text view mobile */
    .fulltext-container {
        flex-direction: column;
        height: auto;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .fulltext-content {
        padding: 1.5rem 1rem;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }
    
    .fulltext-body {
        gap: 2rem;
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .fulltext-body * {
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .section-content {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .fulltext-header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .fulltext-title {
        font-size: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .section-content .chapter-heading,
    .chapter-heading {
        font-size: 1.25rem;
    }
    
    .section-content .chapter-subtitle,
    .chapter-subtitle {
        font-size: 1.1rem;
    }
    
    .section-content .section-heading,
    .section-heading {
        font-size: 1.1rem;
    }
    
    .section-content .fulltext-article .article-heading,
    .section-content .article-heading,
    .fulltext-article .article-heading {
        font-size: 1rem;
    }
    
    .section-heading-major {
        font-size: 1.4rem;
    }
    
    .recital-item {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .recital-number {
        min-width: auto;
    }
    
    /* Mobile close button */
    .mobile-close-btn {
        display: none;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
        min-width: 48px;
        background: transparent;
        border: none;
        color: white;
        font-size: 3rem;
        line-height: 1;
        cursor: pointer;
        padding: 0;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        z-index: 1002;
        flex-shrink: 0;
    }
    
    /* Show close button only when menu is active */
    .sidebar.mobile-active .mobile-close-btn {
        display: flex !important;
    }
    
    .mobile-close-btn:hover {
        color: var(--aqua);
        transform: scale(1.1);
    }
    
    .mobile-close-btn:active {
        transform: scale(0.9);
        color: var(--red);
    }
    
    .close-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 200;
        line-height: 1;
    }
    
    /* Mobile regulation switcher (inside sidebar) */
    .mobile-regulation-switcher {
        display: none;
        background: var(--primary-color);
        border-bottom: 3px solid var(--aqua);
        position: sticky;
        top: 0;
        z-index: 10;
        margin: -1.5rem -1.5rem 2.5rem -1.5rem;
    }
    
    /* Show regulation switcher only when menu is active */
    .sidebar.mobile-active .mobile-regulation-switcher {
        display: block !important;
    }
    
    .mobile-switcher-content {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
        padding-right: 4rem;
    }
    
    .mobile-view-mode {
        display: flex;
        gap: 0.5rem;
        padding: 0.35rem;
        background: var(--lightgrey);
        border-radius: 6px;
    }
    
    .mobile-mode-btn {
        flex: 1;
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-light);
        background: transparent;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        text-decoration: none;
        text-align: center;
        transition: all 0.2s ease;
    }
    
    .mobile-mode-btn:hover {
        color: var(--text-color);
        text-decoration: none;
    }
    
    .mobile-mode-btn.active {
        background: white;
        color: var(--primary-color);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-switcher-dropdown {
        flex: 1;
        min-width: 0;
    }
    
    .mobile-switcher-dropdown label {
        display: block;
        color: var(--aqua);
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.8px;
        margin-bottom: 0.6rem;
    }
    
    .mobile-switcher-dropdown select {
        width: 100%;
        padding: 0.85rem 1rem;
        border: 2px solid var(--aqua);
        border-radius: 8px;
        font-size: 1rem;
        background: white;
        color: var(--primary-color);
        font-weight: 600;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    /* Layout adjustments */
    .layout-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    
    /* Mobile sidebar (slide-out menu) */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        background: var(--bg-color);
        border-right: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: none;
    }
    
    .sidebar.mobile-active {
        left: 0;
    }
    
    .sidebar-content {
        padding: 1.5rem;
        padding-top: 0;
    }
    
    /* Mobile overlay not needed since sidebar is full-screen, but keep for escape/close functionality */
    
    /* Content area adjustments */
    .content-area {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        overflow-y: visible;
        height: auto;
        min-height: auto;
    }
    
    /* Hide recent panel on mobile */
    .recent-panel {
        display: none;
    }
    
    /* Article navigation for mobile */
    .article-navigation {
        flex-direction: row;        /* Stack side-by-side */
        justify-content: space-between; /* Push to far left and far right */
        gap: 0.75rem;
        margin-bottom: 1.5rem;
        
    }
    nav.article-navigation .nav-btn {
        width: auto;               /* Allow them to shrink from 100% */
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }
    
    .nav-hint {
        display: none;
    }
    
    .nav-spacer {
        display: none;
    }
    
    /* Article heading for mobile */
    .article-heading {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }
    
    .article-title-heading {
        font-size: 1rem;
    }
    
    /* Ensure list items don't overflow on mobile */
    .fmx-list-item {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    .fmx-list-item[data-marker] {
        margin-left: 0;
        flex-wrap: wrap;
    }
    
    .fmx-list-item-num {
        min-width: 2rem;
        max-width: 2.5rem;
    }
    
    .fmx-list-item-body {
        flex: 1;
        min-width: 0;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    .fmx-numbered-block {
        flex-wrap: wrap;
        max-width: 100%;
    }
    
    .fmx-numbered-block-num {
        min-width: 2rem;
        max-width: 2.5rem;
    }
    
    .fmx-numbered-block-body {
        flex: 1;
        min-width: 0;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    /* Article body responsive text */
    .article-body,
    .article-body p,
    .article-body div {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    /* TOC adjustments for mobile */
    .toc-header {
        padding-bottom: 0.85rem;
        margin-bottom: 1rem;
        border-bottom: 2px solid var(--border-color);
    }
    
    .sidebar h2 {
        font-size: 0.9rem;
        letter-spacing: 0.3px;
    }
    
    /* Hide table icon on mobile */
    .toc-table-icon {
        display: none;
    }
    
    .toc-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.65rem;
        letter-spacing: 0.2px;
    }
    
    .search-box {
        margin-bottom: 1.25rem;
    }
    
    #search-input {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
        border-radius: 8px;
    }
    
    
    /* Select page for mobile */
    .select-page {
        padding: 1.5rem;
    }
    
    .select-page h2 {
        font-size: 1.5rem;
    }
    
    .select-subtitle {
        font-size: 1rem;
    }
    
    .regulation-list {
        gap: 1rem;
        padding: 0;
    }
    
    .regulation-card {
        padding: 1rem 1.25rem;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .regulation-card-main {
        flex-direction: column;
        gap: 1rem;
    }
    
    .regulation-card-header {
        flex: 1;
    }
    
    .regulation-number {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    .regulation-card-dates {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .regulation-date-item {
        padding: 0.5rem 0.65rem;
    }
    
    .date-icon {
        font-size: 1rem;
    }
    
    .date-label {
        font-size: 0.65rem;
    }
    
    .date-value {
        font-size: 0.8rem;
    }
    
    /* Definition tooltip for mobile */
    .definition-tooltip {
        max-width: calc(100vw - 2rem);
        left: 1rem !important;
        right: 1rem;
        width: auto;
    }
}

/* Extra small devices (phones in portrait mode) */
@media (max-width: 480px) {
    .site-header {
        padding: 0.75rem 1rem;
    }
    
    .site-title {
        font-size: 0.95rem;
    }
    
    .hamburger-menu {
        width: 26px;
        height: 20px;
    }
    
    .hamburger-line {
        height: 2.5px;
    }
    
    .sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .mobile-close-btn {
        top: 0.75rem;
        right: 0.75rem;
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 2.5rem;
    }
    
    .mobile-switcher-content {
        padding: 1rem;
        padding-right: 3.5rem;
        gap: 0.75rem;
    }
    
    .mobile-regulation-switcher {
        margin: -1.5rem -1.5rem 2rem -1.5rem;
    }
    
    .toc-articles a {
        padding: 0.65rem 0.75rem;
    }
    
    .content-area {
        padding: 0.75rem;
    }
    
    .article-heading {
        font-size: 1.2rem;
        padding-left: 0.75rem;
        gap: 0.5rem;
    }
    
    .copy-article-btn {
        height: 32px;
        width: 32px;
        padding: 0.4rem;
    }
    
    .copy-article-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .article-title-heading {
        font-size: 0.9rem;
    }
    
    .article-body {
        font-size: 0.95rem;
    }
    
    .nav-btn {
        font-size: 0.8rem;
        padding: 0.6rem;
    }
        
    .nav-btn .nav-arrow {
        font-size: 1.5rem;
    }
    
    .select-page {
        padding: 1rem;
    }
    
    .select-page h2 {
        font-size: 1.3rem;
    }
    
    .select-subtitle {
        font-size: 0.9rem;
    }
    
    .regulation-card {
        padding: 1.5rem 1rem;
    }
    
    .regulation-card h3 {
        font-size: 1.1rem;
    }
    
    .button {
        padding: 0.65rem 1.5rem;
        font-size: 0.85rem;
    }
}

/* Landscape tablets and small laptops */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .recent-panel {
        width: 240px;
    }
    
    .content-area {
        padding: 1.5rem 2rem;
    }
}

/* Utility Classes */
.uppercase {
    text-transform: uppercase;
}

.no-content {
    padding: 3rem;
    text-align: center;
    color: var(--text-light);
}

.no-content::before {
    content: "📄";
    display: block;
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Articles Table View */
.articles-table-view {
    margin-top: 2rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-view-heading {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--aqua);
}

.articles-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--bg-color);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.articles-table thead {
    background: var(--primary-color);
    color: white;
    border-bottom: 3px solid var(--aqua);
}

.articles-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.articles-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.articles-table tbody tr:last-child {
    border-bottom: none;
}

.articles-table tbody tr:hover {
    background: var(--lightgrey);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(31, 170, 255, 0.1);
}

.articles-table td {
    padding: 1rem;
    vertical-align: top;
}

.article-col-number {
    width: 150px;
    font-weight: 700;
    color: var(--link-color);
}

.article-col-title {
    color: var(--text-color);
    line-height: 1.6;
}

.article-row:hover .article-col-number {
    color: var(--primary-color);
}

/* Responsive table */
@media (max-width: 768px) {
    .articles-table {
        font-size: 0.8rem;
    }
    
    .articles-table th,
    .articles-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .article-col-number {
        width: 100px;
        font-size: 0.75rem;
    }
}

.toc-chapter-title:hover::after,
.toc-section-title:hover::after {
    opacity: 0.7;
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--lightgrey);
    border-top: 3px solid var(--link-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus States for Accessibility */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 3px solid var(--aqua);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .site-header,
    .sidebar,
    .article-navigation,
    .site-footer {
        display: none;
    }
    
    .content-area {
        max-width: 100%;
        padding: 0;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .article-heading {
        color: black;
        border-left-color: black;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
}

/* Smooth Scrollbar */
.sidebar::-webkit-scrollbar,
.recent-panel::-webkit-scrollbar,
.content-area::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.recent-panel::-webkit-scrollbar-track,
.content-area::-webkit-scrollbar-track {
    background: var(--lightgrey);
}

.sidebar::-webkit-scrollbar-thumb,
.recent-panel::-webkit-scrollbar-thumb,
.content-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.recent-panel::-webkit-scrollbar-thumb:hover,
.content-area::-webkit-scrollbar-thumb:hover {
    background: var(--link-color);
}

/* Selection Color */
::selection {
    background: var(--aqua);
    color: var(--primary-color);
}

::-moz-selection {
    background: var(--aqua);
    color: var(--primary-color);
}
