/* =====================================================
   DETAILS TABS — SPLIT PANEL LAYOUT  (v6)
   Add after the existing .details-tabs rules in layout.css
   ===================================================== */

/* ── Nav: hidden tab is greyed/dashed, clicking it restores ── */
.details-tabs-nav { flex-wrap: wrap; align-items: flex-end; }
.details-tabs-nav li {
    position: relative; display: inline-flex;
    align-items: stretch; margin-right: 3px;
}
.details-tabs-nav li a {
    display: inline-flex; align-items: center; white-space: nowrap;
}
.details-tabs-nav li.tab-hidden > a {
    opacity: 0.45; font-style: italic; border-style: dashed !important;
    color: #888 !important; background: transparent !important;
    border-color: #aaa !important; cursor: pointer;
}

/* ── Linked/independent toggle row ── */
.tabs-page-sync-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
    user-select: none;
}
.tabs-page-sync-bar .sync-label { white-space: nowrap; }

/* Vertical separator between toggle group and reset link */
.tabs-page-sync-bar .sync-separator {
    display: inline-block;
    width: 1px;
    height: 16px;
    background: #ccc;
    margin: 0 4px;
    flex-shrink: 0;
}

/* Reset link */
.tabs-reset-link {
    font-size: 12px;
    color: #999;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s;
}
.tabs-reset-link:hover {
    color: #c0392b;
    text-decoration: none;
}

/* Toggle switch */
.sync-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}
.sync-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.sync-track {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 20px;
    transition: background 0.2s;
}
.sync-toggle input:checked + .sync-track { background: #2489d5; }
.sync-thumb {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.sync-toggle input:checked ~ .sync-thumb { left: 19px; }

/* ── Panel header: drag zone + title + eye ── */
.details-tab-header {
    display: flex; align-items: center; margin-bottom: 8px; padding-bottom: 6px;
    border-bottom: 1px solid #e8e8e8; gap: 6px; flex-shrink: 0; user-select: none;
}
.details-tab-header .tab-drag-zone {
    display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; cursor: grab;
}
.details-tab-header .tab-drag-zone:active { cursor: grabbing; }
.details-tab-header .tab-drag-icon { font-size: 14px; color: #ccc; flex-shrink: 0; }
.details-tab-header .tab-header-title {
    font-size: 12px; font-weight: bold; color: #666; flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-transform: uppercase; letter-spacing: 0.04em;
}

/* Eye button */
.tab-eye-btn {
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; width: 22px; height: 22px; border: none;
    background: transparent; cursor: pointer; padding: 0;
    border-radius: 3px; color: #bbb; transition: color 0.15s, background 0.15s;
}
.tab-eye-btn:hover { color: #555; background: rgba(0,0,0,0.06); }
.tab-eye-btn.is-disabled { opacity: 0.2; cursor: default; pointer-events: none; }
.tab-eye-btn svg { display: block; }

/* ── Drop insert line ── */
.tab-drop-line {
    flex: 0 0 3px; width: 3px; background: #2489d5; align-self: stretch;
    border-radius: 3px; box-shadow: 0 0 5px rgba(36,137,213,0.5);
    pointer-events: none; display: none;
}
.tab-drop-line.visible { display: flex; }

.details-tab.is-dragging-source { opacity: 0.4; }

/* ── Wrapper — constrained height with overflow hidden so panels scroll inside ── */
.details-tabs-wrapper {
    display: flex; flex-flow: row nowrap; width: 100%;
    box-sizing: border-box; align-items: stretch; position: relative;
    /* Default height — JS will override with saved value */
    height: 340px;
    min-height: 120px;
}

/* ── Height-resize handle — sits below the wrapper ── */
.tabs-height-handle {
    width: 100%;
    height: 8px;
    margin-top: 2px;
    background: #e8e8e8;
    border-radius: 4px;
    cursor: row-resize;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.tabs-height-handle:hover,
.tabs-height-handle.dragging { background: #2489d5; }
.tabs-height-handle::after {
    content: "— — —";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #bbb;
    font-size: 9px;
    letter-spacing: 2px;
    pointer-events: none;
    line-height: 1;
}
.tabs-height-handle:hover::after { color: #fff; }

/* Prevent text selection while dragging the height handle */
body.tabs-resizing-height { cursor: row-resize !important; user-select: none !important; }

/* ── Each panel ── */
.details-tab {
    display: none; flex-shrink: 0; box-sizing: border-box;
    overflow: hidden; min-width: 80px;
    padding: 10px 12px; border: 1px solid #ddd; border-radius: 3px;
    background: #fff; flex-direction: column;
    position: relative;   /* contain the float within each individual panel */
}
.details-tab.panel-open { display: flex; flex: 1 1 0%; }
.details-tab.panel-open.has-explicit-width { flex: 0 0 auto; }

/* ── Inner row: body only (no rail column) ── */
.details-tab-inner {
    display: flex;
    flex-flow: row nowrap;
    flex: 1;
    min-height: 0;
    gap: 0;
    position: relative;   /* anchor for the absolute float */
}

.details-tab-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

/* Hidden at rest */
.tab-page-float {
    position: absolute;
    top: 0;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 3px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
    z-index: 10;
    max-height: calc(100% - 4px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.tab-page-float::-webkit-scrollbar { display: none; }

/* Translucent when hovering the panel content */
.details-tab-inner:hover .tab-page-float {
    opacity: 0.35;
    pointer-events: auto;
}

/* Fully opaque when hovering the float itself */
.details-tab-inner:hover .tab-page-float:hover {
    opacity: 1;
}

/* Individual notch — a small numbered circle */
.tab-page-notch {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e8e8e8;
    color: #888;
    font-size: 10px;
    font-family: Arial, sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    line-height: 1;
    user-select: none;
    position: relative;
}
.tab-page-notch:hover {
    background: #2489d5;
    color: #fff;
    transform: scale(1.15);
}
.tab-page-notch.is-active {
    background: #2489d5;
    color: #fff;
}

/* Tooltip on notch hover */
.tab-page-notch::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    font-size: 11px;
    font-family: Arial, sans-serif;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 100;
}
.tab-page-notch:hover::after { opacity: 1; }

/* ── Page-break HR styling (frontend equivalent of admin CSS) ── */
hr.system-pagebreak {
    position: relative;
    border: none;
    border-top: 1px dashed #ccc;
    margin: 16px 0;
    overflow: visible;
}
hr.system-pagebreak::before {
    content: attr(data-page-label);
    position: absolute;
    top: -10px;
    left: 0;
    color: #fff;
    background: #007ad9;
    font-size: 13px;
    padding: 2px 20px;
    line-height: 15px;
    border-radius: 10px;
    font-family: Arial, sans-serif;
    pointer-events: none;
}

/* ── Resizer ── */
.tab-resizer {
    flex: 0 0 7px; width: 7px; background: #e8e8e8;
    cursor: col-resize; position: relative; border-radius: 3px;
    transition: background 0.2s; align-self: stretch; flex-shrink: 0;
}
.tab-resizer:hover, .tab-resizer.dragging { background: #2489d5; }
.tab-resizer::after {
    content: "⋮"; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); color: #bbb; font-size: 14px; pointer-events: none;
}
.tab-resizer:hover::after, .tab-resizer.dragging::after { color: #fff; }

.details-tabs-wrapper.is-resizing,
.details-tabs-wrapper.is-drag-reordering { user-select: none; }

.details-tab img { max-width: 100%; height: auto; display: block; }
