/* ============================================================
   note.css — Shared A4 Layout Styles
   Used by: doc.php, page-show.php, subdomain.php (is_note)
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #535353;
    font-family: "Times New Roman", serif;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* ── Toolbar ── */
.controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(to bottom, #414141db, #4f4f4f);
    border-bottom: 1px solid #656565;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.controls.subnote i {
    color: #fecd1a;
}

#a4-title {
    max-width: 210mm;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Buttons ── */
.btn {
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: system-ui, -apple-system, sans-serif;
    background: white;
    color: #333;
    text-decoration: none;
}

.btn-secondary {
    background: #3b3b3b;
    color: #c5c5c5;
    border-color: #313131;
}

.btn-secondary:hover {
    background: #353535;
}

.btn-success {
    background: #1e293b;
    color: white;
    border-color: #394353;
}

.btn-success:hover {
    background: #283750;
}

/* ── Zoom controls ── */
.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ── A4 Paper ── */
.a4-container {
    width: 210mm;
    min-height: auto;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    margin: 60px auto 20px;
    position: relative;
}

.a4-page {
    padding: 2cm 2cm 2cm 3cm;
    font-family: "Times New Roman", serif;
    font-size: 14pt;
    line-height: 1.5;
    text-align: justify;
    color: #000;
}

/* ── Typography ── */
.a4-page h1 {
    font-size: 24pt;
    font-weight: bold;
    margin-top: 12pt;
    margin-bottom: 6pt;
    color: #000;
    text-align: left;
}

.a4-page h2 {
    font-size: 20pt;
    font-weight: bold;
    margin-top: 10pt;
    margin-bottom: 6pt;
    color: #000;
}

.a4-page h3 {
    font-size: 18pt;
    font-weight: bold;
    margin-top: 8pt;
    margin-bottom: 6pt;
    color: #000;
}

.a4-page h4 {
    font-size: 16pt;
    font-weight: bold;
    margin-top: 6pt;
    margin-bottom: 6pt;
    color: #000;
}

.a4-page pre {
    white-space: break-spaces;
    background: #e4f0f5;
    border: 1px solid #a2d3e9;
    padding: 15px;
    color: #1e4c7f;
    font-size: 15px;
}

.a4-page code {
    white-space: break-spaces;
    background: #e4f0f5;
    color: #1e4c7f;
    font-size: 15px;
}

.a4-page p {
    margin-top: 0;
    margin-bottom: 10pt;
}

.a4-page ul,
.a4-page ol {
    margin-top: 0;
    margin-bottom: 10pt;
    padding-left: 40px;
}

.a4-page li {
    margin-bottom: 6pt;
}

.a4-page figure {
    margin-bottom: 30px;
    text-align: center;
}

.a4-page figcaption {
    font-style: italic;
    margin-top: -10px;
    font-size: 15px;
    margin-bottom: 30px;
    text-align: center;
}

.a4-page strong {
    font-weight: bold;
}

.a4-page em {
    font-style: italic;
}

.a4-page table {
    border-collapse: collapse;
    width: 100%;
    margin: 10pt 0;
}

.a4-page td,
.a4-page th {
    border: 1px solid #000;
    padding: 6pt;
}

.a4-page a {
    color: #0066cc;
    text-decoration: underline;
}

.a4-page img {
    max-width: 100%;
    height: auto;
    margin: 10pt 0;
}

/* ── Metadata (page-show.php) ── */
.a4-metadata {
    margin-bottom: 20pt;
    color: #444;
    font-size: 12pt;
    display: flex;
    align-items: center;
    gap: 15px;
    font-style: italic;
    border-bottom: 1px solid #eee;
    padding-bottom: 8pt;
}

.a4-metadata i {
    margin-right: 5px;
    color: #666;
}

/* ── Taxonomy Badges (page-show.php) ── */
.pro-doc-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge-type {
    font-size: 11px;
    padding: 5px 15px;
    border-radius: 20px;
    background: #3b82f65c;
    color: #1e3a5f;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.badge-type:hover {
    background: #3b82f6a0;
    color: #fff;
}

/* ── Subdomain: Note variant (yellow theme) ── */
.a4-note-theme .a4-container {
    background: #ffeec5;
}

.a4-note-theme .a4-page h1.a4-note {
    color: #cb8000;
    border-bottom: 2px dashed;
    margin-bottom: 20px;
    margin-top: 0;
    text-align: left;
}

/* ── TOC Sidebar (desktop) ── */
#toc-panel {
    display: none;
    position: fixed;
    top: 70px;
    left: 12px;
    width: 230px;
    max-height: calc(100vh - 80px);
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 900;
    overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
    transition: width 0.3s ease, opacity 0.3s ease;
}

#toc-panel.visible {
    display: flex;
    flex-direction: column;
}

#toc-panel.collapsed {
    width: 36px;
}

#toc-panel.collapsed #toc-list,
#toc-panel.collapsed #toc-header-text,
#toc-panel.collapsed #toc-icon {
    display: none;
}

#toc-header {
    padding: 10px;
    background: #1e1e1e;
    border-bottom: 1px solid #444;
    font-size: 12px;
    font-weight: 600;
    color: #aaa;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
    cursor: default;
    user-select: none;
}

#toc-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

#toc-toggle-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

#toc-toggle-btn:hover {
    color: #fff;
    background: #3a3a3a;
}

#toc-toggle-btn .toc-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-style: normal;
    font-size: 14px;
}

#toc-panel.collapsed #toc-toggle-btn .toc-arrow {
    transform: rotate(180deg);
}

#toc-list {
    overflow-y: auto;
    padding: 8px 0;
    flex: 1;
}

#toc-list::-webkit-scrollbar {
    width: 4px;
}

#toc-list::-webkit-scrollbar-track {
    background: #2b2b2b;
}

#toc-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}

.toc-item {
    display: block;
    padding: 5px 14px;
    font-size: 12.5px;
    color: #bbb;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-item:hover {
    background: #3a3a3a;
    color: #fff;
}

.toc-item.active {
    background: #3a3a3a;
    color: #4fc3f7;
    border-left: 2px solid #4fc3f7;
}

.toc-h2 {
    padding-left: 14px;
}

.toc-h3 {
    padding-left: 26px;
    font-size: 12px;
}

.toc-h4 {
    padding-left: 38px;
    font-size: 11.5px;
}

.toc-h5 {
    padding-left: 50px;
    font-size: 11px;
    color: #999;
}

.toc-h6 {
    padding-left: 62px;
    font-size: 10.5px;
    color: #888;
}

@media screen and (max-width: 1100px) {
    #toc-panel {
        display: none !important;
    }
}

/* ── Mobile FAB & Drawer ── */
#toc-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1e1e1e;
    border: 1px solid #444;
    color: #bbb;
    font-size: 18px;
    cursor: pointer;
    z-index: 1100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

#toc-fab:hover {
    background: #2e2e2e;
    transform: scale(1.08);
}

#toc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

#toc-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#toc-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: #2b2b2b;
    border-top: 1px solid #444;
    border-radius: 16px 16px 0 0;
    z-index: 1060;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    font-family: system-ui, -apple-system, sans-serif;
}

#toc-drawer.open {
    transform: translateY(0);
}

#toc-drawer-header {
    padding: 12px 16px 10px;
    background: #1e1e1e;
    border-bottom: 1px solid #444;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#toc-drawer-title {
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 7px;
}

#toc-drawer-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
}

#toc-drawer-close:hover {
    color: #fff;
    background: #3a3a3a;
}

#toc-drawer-list {
    overflow-y: auto;
    padding: 8px 0 20px;
    flex: 1;
}

#toc-drawer-list::-webkit-scrollbar {
    width: 4px;
}

#toc-drawer-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}

@media screen and (max-width: 1100px) {
    #toc-fab.toc-ready {
        display: flex;
    }

    #toc-overlay,
    #toc-drawer {
        display: flex;
    }
}

/* ── Responsive ── */
@media screen and (max-width: 768px) {
    .controls {
        padding: 10px;
        gap: 8px;
    }

    body {
        padding-top: 60px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 10px;
    }

    .a4-container {
        width: 100%;
        min-width: auto;
        margin: 20px 0;
    }

    .a4-page {
        padding: 20px;
    }

    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .zoom-controls,
    .print-controls {
        display: none !important;
    }
}

/* ── Print ── */
@media print {
    @page {
        size: A4;
        margin: 2cm 1.5cm 2cm 3cm;
    }

    body {
        background: white;
        padding: 0;
    }

    .controls, .no-print {
        display: none !important;
    }

    .a4-container {
        width: 100%;
        box-shadow: none;
        margin: 0;
    }

    .a4-page {
        padding: 0;
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 7px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgb(96, 97, 97);
    border-radius: 0px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}


blockquote {
    margin: 30px 0;
    padding: 20px 30px 20px 60px;
    background: #f3f3f3;
    border-left: 4px solid #cbd5e1;
    color: #374151;
    font-style: italic;
    font-size: 18px;
    line-height: 1.9;

    position: relative;
}

/* dấu quote lớn */
blockquote::before {
    content: "“";
    position: absolute;
    left: 18px;
    top: 10px;

    font-size: 60px;
    line-height: 1;
    color: #9ca3af;
    font-family: Georgia, serif;
}

/* đoạn text */
blockquote p {
    margin: 0;
}