/* Photobook GUI — dark, Image-Processor-style shell. */

#photobook-app {
    background: #0d1117;
    color: #c9d1d9;
    font-size: 13px;
}

/* ---------- menubar ---------- */
.pb-menubar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 2px;
    background: #1c2333;
    border-bottom: 1px solid #30363d;
    padding: 0 6px;
    position: relative;
    z-index: 60;
}
.pb-menu { position: relative; }
.pb-menu-btn {
    background: transparent;
    border: 0;
    color: #c9d1d9;
    padding: 8px 12px;
    font: inherit;
    cursor: pointer;
}
.pb-menu-btn:hover,
.pb-menu.open .pb-menu-btn { background: #1f2a40; color: #fff; }
.pb-menu-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 190px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .55);
    z-index: 70;
}
.pb-menu.open .pb-menu-list { display: block; }
.pb-menu-list a {
    display: block;
    padding: 7px 14px;
    color: #c9d1d9;
    text-decoration: none;
    white-space: nowrap;
}
.pb-menu-list a:hover,
.pb-menu-list a.active { background: #1f2a40; color: #fff; }
.pb-menu-list .pb-sep { height: 1px; margin: 4px 0; background: #30363d; }

.pb-menu-sub { position: relative; }
.pb-menu-sub > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.pb-menu-sub > a::after { content: "\25B8"; font-size: 11px; color: #8b949e; }
.pb-submenu {
    display: none;
    position: absolute;
    top: -5px;
    left: 100%;
    min-width: 180px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .55);
    z-index: 80;
}
.pb-menu-sub:hover > .pb-submenu,
.pb-menu-sub.open > .pb-submenu { display: block; }

/* ---------- toolbar ---------- */
.pb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 4px 8px;
}
.pb-tool {
    min-width: 30px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 5px;
    color: #c9d1d9;
    cursor: pointer;
    padding: 0 6px;
    font: inherit;
}
.pb-tool:hover { background: #30363d; color: #fff; }
.pb-tool .ui-icon {
    margin: 0;
    background-image: url("images/ui-icons_ffffff_256x240.png") !important;
}
.pb-toolbar-sep { width: 1px; height: 20px; background: #30363d; margin: 0 6px; }
.pb-toolbar-label { color: #c9d1d9; margin: 0 6px 0 2px; }
#pb-page-select {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
}
.pb-refresh {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    height: 28px;
    box-sizing: border-box;
    background: #dddd44;
    color: #000;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 0 12px;
    font-weight: bold;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}
.pb-refresh:hover { background: #e7e75a; color: #000; }

/* ---------- main layout ---------- */
#pb-main { display: flex; align-items: stretch; height: calc(100vh - 210px); min-height: 420px; }
#pb-canvas-pane {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    box-sizing: border-box;
}
#pb-overview-wrap,
#pb-editor-wrap {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 6px;
    box-sizing: border-box;
}
#pb-editor-wrap { flex: 1 1 0; min-height: 0; overflow: hidden; }
#pb-overview-wrap { flex: 0 0 auto; max-height: 40%; overflow-x: auto; overflow-y: hidden; }
#pb-overview, #pb-editor { display: block; width: 100%; background: #0d1117; border-radius: 4px; }
#pb-editor { cursor: default; }
#pb-overview { cursor: pointer; }

#pb-splitter {
    flex: 0 0 5px;
    align-self: stretch;
    cursor: col-resize;
    background: #30363d;
    border-radius: 2px;
    margin: 8px 3px;
    min-height: 220px;
    transition: background-color .15s;
}
#pb-splitter:hover { background: #d97706; }

#pb-settings {
    flex: 0 0 340px;
    min-width: 220px;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #161b22;
    box-sizing: border-box;
    padding: 0 8px 10px;
}
/* Only the settings pages scroll; the group picker stays put and the
   selection block is pinned to the bottom behind a divider. */
#pb-settings-panel {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}
#pb-settings-panel::-webkit-scrollbar { width: 8px; }
#pb-settings-panel::-webkit-scrollbar-track { background: #0d1117; }
#pb-settings-panel::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
#pb-group-select {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
    margin-bottom: 4px;
}
.pb-section { display: none; }
.pb-section.active { display: flex; flex-direction: column; gap: 6px; }
.pb-settings-blocks h3 {
    display: block;
    font-size: 13px;
    color: #fff;
    margin: 0;
    padding: 0;
    border: 0;
}
.pb-settings-blocks .pb-section {
    background: #1c2333;
    border-radius: 4px;
    padding: 0.75em;
    margin: 0 0 6px;
}
.pb-control { padding: 0; margin: 0; font-size: 12px; display: inline-block; }
.pb-control.pb-block { display: block; }
.pb-control > span, .pb-control > label { color: #8b949e; font-size: 12px; }
.pb-settings-sub { color: #8b949e; font-size: 11px; margin: 0; padding: 0; }

#pb-settings-panel input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#pb-settings-panel select,
#pb-settings-panel textarea {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
    min-height: 24px;
    box-sizing: border-box;
}
#pb-settings-panel textarea { width: 100%; min-height: 52px; }
#pb-settings-panel select { height: 26px; }
.pb-btn {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    margin: 2px 4px 2px 0;
}
.pb-btn:hover { background: #30363d; color: #fff; }
.pb-btn:disabled { opacity: .45; cursor: default; }

/* ---------- gallery ---------- */
#pb-gallery {
    background: #161b22;
    border-top: 1px solid #30363d;
    padding: 6px;
    box-sizing: border-box;
}
#pb-pool { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.pb-page-block {
    position: relative;
    flex: 0 0 156px;
    aspect-ratio: 0.707;
    padding: 0;
    background: #ffffff;
    border: 1px solid #30363d;
    border-radius: 4px;
    overflow: hidden;
}
.pb-page-block.drop-hover { border-color: #58a6ff; }
.pb-page-block.active { border-color: #58a6ff; box-shadow: inset 0 0 0 1px #58a6ff; }
.pb-page-block.active::before { color: #58a6ff; }
.pb-page-block::before {
    content: attr(data-label);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    padding: 2px 5px;
    font-size: 10px;
    color: #6b7280;
    background: rgba(255, 255, 255, .85);
    pointer-events: none;
}

.pb-thumb {
    position: absolute;
    z-index: 1;
    background: #161b22;
    border: 1px solid #d0d7de;
    border-radius: 2px;
    overflow: hidden;
    cursor: grab;
    box-sizing: border-box;
}
.pb-thumb.pb-placeholder {
    background: transparent;
    border-style: dashed;
}
.pb-text-mark.pb-mark-heading { font-weight: bold; font-size: 10px; }
.pb-text-mark {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b949e;
    font-size: 9px;
    background: #f6f8fa;
    border: 1px dashed #b9c2cc;
    border-radius: 2px;
    box-sizing: border-box;
}
.pb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pb-thumb.ui-sortable-helper { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.pb-pool-empty { color: #8b949e; font-size: 12px; }
/* Settings panel toggle: hide it (and the splitter) to give the canvas full space. */
#pb-main.pb-settings-hidden #pb-settings,
#pb-main.pb-settings-hidden #pb-splitter { display: none; }
#pb-toggle-settings.active { background: #1f6feb; border-color: #58a6ff; color: #fff; }

.pb-panel-icon { display: block; }

/* Display modes: single page (editor) or overview (page strip). */
#pb-main.pb-page-mode #pb-overview-wrap { display: none; }
#pb-main.pb-overview-mode #pb-editor-wrap { display: none; }
#pb-main.pb-overview-mode #pb-overview-wrap { flex: 1 1 auto; max-height: none; }
.pb-view-icon { display: block; }
.pb-tool.active { background: #1f6feb; border-color: #58a6ff; color: #fff; }

/* Context menu (long-press / right-click) */
.pb-ctx {
    position: absolute;
    z-index: 200000;
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
    padding: 4px;
}
.pb-ctx button {
    display: block;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    background: transparent;
    border: 0;
    color: #c9d1d9;
    font: inherit;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
}
.pb-ctx button:hover { background: #1f2a40; color: #fff; }

/* Modal dialog (text entry) */
.pb-modal {
    position: fixed;
    inset: 0;
    z-index: 200001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .6);
    padding: 16px;
}
.pb-modal-dialog {
    width: 100%;
    max-width: 460px;
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.pb-modal-dialog h3 { margin: 0 0 8px; font-size: 14px; color: #fff; }
.pb-modal-dialog textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 110px;
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px;
    font: inherit;
    resize: vertical;
}
.pb-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.pb-modal-actions button {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 6px 14px;
    cursor: pointer;
    font: inherit;
}
.pb-modal-actions button:hover { background: #30363d; color: #fff; }

/* Selection label + object size (always visible above the settings groups) */

/* Group selector aligned with the section blocks */
.pb-group-wrap { flex: 0 0 auto; margin: 6px 0; }

/* Selection block pinned under the scrolling settings, above a divider */
.pb-selection-block {
    flex: 0 0 auto;
    background: transparent;
    border-top: 1px solid #30363d;
    border-radius: 0;
    padding: 10px 0 0;
    margin: 10px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pb-selection-info {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    font-size: 12px;
    color: #c9d1d9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pb-selection-size {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #8b949e;
}
#pb-settings .pb-selection-size input {
    width: 4.5em;
    height: 26px;
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    box-sizing: border-box;
}

/* App is the positioning root for menus/dialogs */
#photobook-app { position: relative; }

/* PDF ready toast */
.pb-toast {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 12px;
    color: #c9d1d9;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.pb-toast a { color: #58a6ff; font-weight: bold; text-decoration: none; }
.pb-toast a:hover { text-decoration: underline; }
.pb-toast button {
    background: transparent;
    border: 0;
    color: #8b949e;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.pb-toast button:hover { color: #fff; }

/* Gallery background swatch sits behind thumbs and never intercepts clicks */
.pb-bg-mark {
    position: absolute;
    z-index: 0;
    border-radius: 2px;
    pointer-events: none;
}
.pb-text-mark { pointer-events: none; }

/* Spectrum: colour applies on pick, no separate Choose button */
.sp-container .sp-choose { display: none !important; }

.pb-lock-aspect { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #8b949e; margin: 0; }
.pb-lock-aspect input { margin: 0; }

/* On-page help (shared dark theme for PCC and Photobook) */
.pcc-help, .pb-help {
    max-width: 900px;
    margin: 2em auto 3em;
    padding: 20px 22px 22px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 10px;
    color: #c9d1d9;
    font-size: 15px;
    line-height: 1.65;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.pcc-help h2, .pb-help h2 { font-size: 24px; margin: 0 0 .35em; color: #e6edf3; }
.pcc-help-intro, .pb-help-intro { color: #8b949e; margin: 0 0 1.1em; }
.pcc-help ul, .pb-help ul { margin: .3em 0 .7em 1.3em; padding: 0; }
.pcc-help li, .pb-help li { margin: .25em 0; }
.pcc-help strong, .pb-help strong { color: #e6edf3; }
.pcc-help a, .pb-help a { color: #58a6ff; }
.pcc-help code, .pb-help code {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 1px 5px;
    color: #e6edf3;
}
.pcc-help .ui-accordion-header, .pb-help .ui-accordion-header {
    position: relative;
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    border-radius: 6px !important;
    margin: .45em 0 0 !important;
    padding: .65em 2.4em .65em .9em !important;
    font-size: 15px !important;
    color: #e6edf3 !important;
    font-weight: 600 !important;
    cursor: pointer;
}
.pcc-help .ui-accordion-header:hover, .pb-help .ui-accordion-header:hover { background: #1c2128 !important; }
.pcc-help .ui-accordion-header-active, .pb-help .ui-accordion-header-active {
    background: #1f2a40 !important;
    border-color: #3b4a63 !important;
    color: #ffffff !important;
}
.pcc-help .ui-accordion-header-icon, .pb-help .ui-accordion-header-icon { display: none !important; }
.pcc-help .ui-accordion-header::after, .pb-help .ui-accordion-header::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid #8b949e;
    border-bottom: 2px solid #8b949e;
    transform: translateY(-70%) rotate(45deg);
    transition: transform .15s ease, border-color .15s ease;
}
.pcc-help .ui-accordion-header-active::after, .pb-help .ui-accordion-header-active::after {
    border-color: #58a6ff;
    transform: translateY(-30%) rotate(-135deg);
}
.pcc-help .ui-accordion-content, .pb-help .ui-accordion-content {
    background: #0d1117 !important;
    border: 1px solid #30363d !important;
    border-top: 0 !important;
    border-radius: 0 0 6px 6px !important;
    padding: .9em 1.05em !important;
    color: #c9d1d9 !important;
}
.pcc-help .ui-accordion-content p, .pb-help .ui-accordion-content p { margin: .5em 0; }
.pcc-help .ui-accordion-content p:last-child, .pb-help .ui-accordion-content p:last-child { margin-bottom: 0; }
.pcc-help .pcc-help-subaccordion .ui-accordion-header,
.pb-help .pb-help-subaccordion .ui-accordion-header {
    font-size: 13.5px !important;
    background: #1c2128 !important;
    color: #c9d1d9 !important;
    padding: .55em 2.2em .55em .85em !important;
}
.pcc-help .pcc-help-subaccordion .ui-accordion-header-active,
.pb-help .pb-help-subaccordion .ui-accordion-header-active { background: #1f2a40 !important; color: #ffffff !important; }
.pcc-help h4, .pb-help h4 { font-size: 14px; margin: .3em 0 .3em; color: #e6edf3; }

/* Group picker spans the panel: it chooses what the settings below show. */
#pb-group-select { width: 100%; }

/* Project dialogs */
.pb-modal-body { display: flex; flex-direction: column; gap: 8px; }
.pb-modal-hint { margin: 0; font-size: 12px; color: #8b949e; line-height: 1.45; }
.pb-modal-label { font-size: 12px; color: #8b949e; }
.pb-modal-input {
    width: 100%;
    box-sizing: border-box;
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 13px;
}
.pb-modal-actions .pb-modal-primary { background: #1f6feb; border-color: #58a6ff; color: #fff; }
.pb-modal-actions .pb-modal-primary:hover { background: #2b7bf3; }
.pb-project-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
}
.pb-project-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
}
.pb-project-info { display: flex; flex-direction: column; min-width: 0; }
.pb-project-name { color: #e6edf3; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-project-meta { color: #8b949e; font-size: 11px; }
.pb-project-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.pb-project-actions button {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    border-radius: 4px;
    padding: 4px 9px;
    font-size: 12px;
    cursor: pointer;
}
.pb-project-actions button:hover { background: #30363d; color: #fff; }
.pb-project-actions .pb-project-delete:hover { border-color: #f85149; color: #f85149; }
