/* ── Editor Full-Bleed Container ── */

.akn-editor-fullbleed {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
    overflow: hidden;
}

/* ── Document Editor Toolbar ── */

.editor-toolbar {
    border-bottom: 1px solid var(--rz-base-300);
    padding: 0.375rem 0.75rem;
    flex-shrink: 0;
    background: var(--rz-base-background);
}

/* Light mode: make toolbar icon buttons visible */
body.rz-light .editor-toolbar .rz-button.rz-variant-text.rz-light {
    color: var(--rz-text-color);
}

/* Hover effect on toolbar buttons */
.editor-toolbar .rz-button.rz-variant-text:not([disabled]):hover {
    background-color: var(--rz-base-300);
    border-radius: var(--rz-border-radius);
}

.toolbar-divider {
    width: 1px;
    height: 1.25rem;
    background: var(--rz-base-300);
    margin: 0 0.125rem;
}

.toolbar-divider-lg {
    width: 1px;
    height: 1.25rem;
    background: var(--rz-base-300);
    margin: 0 0.25rem;
}

.editor-title {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.presence-avatar {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.zoom-label {
    font-size: 0.7rem;
    color: var(--rz-text-tertiary-color);
    min-width: 2rem;
    text-align: center;
}

.zoom-slider {
    width: 6rem;
}

.word-count {
    font-size: 0.7rem;
    color: var(--rz-text-tertiary-color);
    white-space: nowrap;
}

.btn-min-sm {
    min-width: 2rem;
}

.lang-selector {
    min-width: 4.5rem;
}

.flag-sm {
    font-size: 0.8rem;
}

.lang-icon {
    font-size: 0.9rem;
}

.editor-html {
    width: 100%;
    min-height: 10rem;
}

/* ── AKN Inline Editor Toolbar ── */

.akn-inline-editor-wrapper {
    cursor: default;
}

.akn-inline-editor-wrapper .rz-html-editor-content {
    cursor: text;
}

.akn-inline-editor-wrapper .rz-html-editor .rz-html-editor-toolbar {
    flex-wrap: wrap;
    gap: 0.125rem;
}

.akn-inline-editor-wrapper .rz-html-editor-toolbar button:not([disabled]) {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.akn-inline-editor-wrapper .rz-html-editor-toolbar button:not([disabled]):hover {
    background-color: var(--rz-base-300);
    border-radius: var(--rz-border-radius);
}

.akn-inline-editor-wrapper.show-blocks .rz-html-editor-content p,
.akn-inline-editor-wrapper.show-blocks .rz-html-editor-content div,
.akn-inline-editor-wrapper.show-blocks .rz-html-editor-content blockquote,
.akn-inline-editor-wrapper.show-blocks .rz-html-editor-content li {
    outline: 1px dashed var(--rz-base-400);
    outline-offset: 2px;
}

.akn-inline-editor-wrapper.rtl-mode .rz-html-editor-content {
    direction: rtl;
    text-align: right;
}

/* ── Footnotes inside the inline editor — show only superscript marker ── */

.akn-inline-editor-wrapper .rz-html-editor-content .akn-authorial-note {
    display: inline;
    font-size: 0;
    line-height: 0;
    color: transparent;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    vertical-align: baseline;
    cursor: pointer;
    user-select: none;
}

.akn-inline-editor-wrapper .rz-html-editor-content .akn-authorial-note[data-marker]::before {
    content: "(" attr(data-marker) ")";
    font-size: 0.75rem;
    vertical-align: super;
    font-weight: 600;
    color: var(--rz-primary, #1e88e5);
    margin-right: 0.125rem;
    background: rgba(var(--rz-primary-rgb, 33, 150, 243), 0.1);
    padding: 0 0.2rem;
    border-radius: 0.2rem;
    cursor: pointer;
    line-height: 1;
}

.akn-inline-editor-wrapper .rz-html-editor-content .akn-authorial-note[data-marker]:hover::before {
    background: rgba(var(--rz-primary-rgb, 33, 150, 243), 0.2);
    text-decoration: underline;
}

.rz-dark .akn-inline-editor-wrapper .rz-html-editor-content .akn-authorial-note[data-marker]::before {
    background: rgba(var(--rz-primary-rgb, 33, 150, 243), 0.15);
}

.lang-dropdown-sm {
    min-width: 4rem;
    max-width: 5rem;
    font-family: 'Roboto', sans-serif;
}

.akn-inline-editor-wrapper > .rz-stack {
    font-family: 'Roboto', sans-serif;
}

/* ── Editor Layout ── */

.editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    background: var(--rz-base-200);
    display: flex;
    flex-direction: column;
}

.editor-loading {
    padding: 3rem;
    flex: 1;
}

.editor-paper {
    max-width: 55rem;
    margin: 1.5rem auto;
    padding-bottom: 2rem;
}

/* ── Panels (TOC, Versions, Annotations) ── */

.panel-header {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--rz-base-300);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-title {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.panel-close-btn {
    min-width: 1.5rem;
    min-height: 1.5rem;
}

.panel-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 0.25rem;
}

.panel-scroll-no-pad {
    overflow-y: auto;
    flex: 1;
}

.side-panel {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-panel-left {
    border-right: 1px solid var(--rz-base-300);
    min-width: 10rem;
    max-width: 24rem;
}

.side-panel-right {
    border-left: 1px solid var(--rz-base-300);
    min-width: 14rem;
    max-width: 28rem;
}

.resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.2s;
}

.resize-handle:hover {
    background: var(--rz-primary);
}

/* ── Search Bar ── */

.search-bar {
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--rz-base-300);
    background: var(--rz-base-100);
    flex-shrink: 0;
}

.search-input {
    min-width: 12rem;
    flex: 1;
    max-width: 20rem;
}

.search-counter {
    font-size: 0.8rem;
    color: var(--rz-text-secondary-color);
    white-space: nowrap;
}

/* ── Document Cards (ActDetail) ── */

.doc-card-compact {
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
}

/* ── TOC ── */

.toc-progress-track {
    height: 3px;
    background: var(--rz-base-300);
    border-radius: 2px;
    margin-bottom: 0.25rem;
    overflow: hidden;
}

.toc-progress-bar {
    height: 100%;
    background: var(--rz-primary);
    transition: width 0.15s ease;
}

.toc-icon {
    font-size: 0.875rem;
    opacity: 0.6;
    margin-right: 0.25rem;
}

/* ── Version Panel ── */

.version-panel-container {
    padding: 0.5rem;
}

.version-card {
    padding: 0.5rem;
}

/* ── Annotation loading / empty states ── */

.annotation-loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.annotation-empty {
    padding: 1rem;
    text-align: center;
    color: var(--rz-text-secondary-color);
}

.annotation-empty-icon {
    font-size: 2rem;
}

.annotation-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.annotation-new-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* Touch targets */
.touch-target {
    min-width: 2.75rem;
    min-height: 2.75rem;
}

/* ── Language Resolution Dialog ── */

.lang-resolution-item {
    padding: 0.5rem;
}

/* ── AknHtmlRenderer context buttons ── */

.akn-ctx-primary {
    color: var(--rz-primary);
}

.akn-ctx-danger {
    color: var(--rz-danger);
}

/* ── Search filter fields ── */

.filter-field-type {
    min-width: 10rem;
}

.filter-field-status {
    min-width: 10rem;
}

.filter-field-lang {
    min-width: 8rem;
}

/* ── Act search clear button ── */

.search-clear-overlay {
    margin-left: -2.25rem;
    z-index: 1;
}

.search-input-constrained {
    max-width: 16rem;
}

.search-input-wide {
    max-width: 20rem;
}

/* ── Annexe section ── */

.annex-title {
    font-weight: 600;
}

.annex-section {
    margin-top: 0.75rem;
    padding-bottom: 1rem;
}

.annex-card {
    margin-bottom: 0.25rem;
}

.annex-card-new {
    animation: annex-flash 4s ease-out;
    box-shadow: 0 0 0 2px var(--rz-success, #28a745);
}

@keyframes annex-flash {
    0% { background-color: rgba(40, 167, 69, 0.25); }
    70% { background-color: rgba(40, 167, 69, 0.08); }
    100% { background-color: transparent; }
}

.annex-number-badge {
    font-weight: 600;
    min-width: 3.5rem;
    text-align: center;
}

.form-action-bar {
    width: 100%;
}

.annex-divider {
    height: 1px;
    background: var(--rz-base-300);
    margin: 0.75rem 0 0.5rem;
}

/* ── Wizard container ── */

.wizard-container {
    max-width: 50rem;
    margin: 0 auto;
}

/* ── Tree panel ── */

.tree-panel {
    width: 100%;
    min-height: 10rem;
}

/* ── Annotation helpers ── */

.annotation-body {
    margin: 0.5rem 0;
}

.annotation-author-name {
    font-weight: 600;
}

.annotation-timestamp {
    margin-left: 0.5rem;
    color: var(--rz-text-secondary-color);
}

.annotation-resolved {
    color: var(--rz-text-secondary-color);
}

.quote-icon {
    font-size: 0.875rem;
    vertical-align: middle;
}

.reply-input {
    min-height: 2.75rem;
}

.reply-send-btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
    align-self: flex-end;
}

/* ── Reader dropdown ── */

.reader-lang-dropdown {
    min-width: 5rem;
}

/* ── Annotation panel helpers ── */

.annotation-loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.annotation-empty {
    padding: 1rem;
    text-align: center;
    color: var(--rz-text-secondary-color);
}

.annotation-empty-icon {
    font-size: 2rem;
}

.annotation-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.annotation-new-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* Special character dialog */
.special-char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
    gap: 0.25rem;
    max-height: 18rem;
    overflow-y: auto;
}

.special-char-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
    border: 1px solid var(--rz-base-300);
    border-radius: var(--rz-border-radius);
    background: var(--rz-base-background-color);
    color: var(--rz-text-color);
    cursor: pointer;
    transition: background 0.15s;
}

.special-char-cell:hover {
    background: var(--rz-secondary-lighter);
}

/* Track Changes panel */
.tc-panel-container {
    padding: 0.5rem;
}

.tc-delta-card {
    padding: 0.75rem !important;
}

.tc-filter-dropdown .rz-dropdown {
    min-height: 1.75rem;
}

/* DAP panel */
.dap-panel-container {
    padding: 0.5rem;
}

.dap-element-card {
    padding: 0.75rem !important;
}

.dap-info-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.dap-link {
    font-size: 0.8125rem;
    color: var(--rz-primary);
    text-decoration: none;
}

.dap-link:hover {
    text-decoration: underline;
}

.dap-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footnote panel */
.footnote-panel-container {
    padding: 0.5rem;
}

.footnote-panel-card {
    padding: 0.75rem !important;
}

.footnote-panel-text {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--rz-text-secondary-color);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.footnote-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--rz-info, #3a86cc);
    color: #fff;
    margin-left: -0.25rem;
    vertical-align: middle;
}
