/* ================================================================================
   STYLESHEET: components.css
   CREATED:    2026-03-15
   MODIFIED:   2026-03-15
   PURPOSE:    Category Picker and Combo-Box reusable component styles
   ================================================================================ */

/* ========== 2026-03-16 CAPTION TEXT (shared detail + creator) ========== */
.caption-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
    line-height: 1.4;
}

/* ========== 2026-03-04 CATEGORY PICKER (hierarchical) ========== */
.cat-picker-trigger {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #333;
}
.cat-picker-trigger .cat-path-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cat-picker-trigger .cat-path-text.placeholder {
    color: #999;
}
.cat-picker-trigger .cat-chevron-down {
    width: 16px;
    height: 16px;
    color: #999;
    flex-shrink: 0;
    margin-left: 8px;
    transition: transform 0.2s;
}
.cat-picker-trigger.open .cat-chevron-down {
    transform: rotate(180deg);
}
.cat-picker-panel {
    display: none;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    margin-top: 6px;
    max-height: 280px;
    overflow-y: auto;
}
.cat-picker-panel.open {
    display: block;
}
.cat-picker-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #666;
    gap: 6px;
}
.cat-picker-back {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    color: #2563eb;
    flex-shrink: 0;
}
.cat-picker-back:hover {
    background: #f0f0f0;
}
.cat-picker-path {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: #333;
}
.cat-picker-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    gap: 8px;
    transition: background 0.1s;
}
.cat-picker-item:hover {
    background: #f5f5f7;
}
.cat-picker-item.selected {
    background: rgba(37, 99, 235, 0.08);
}
.cat-picker-item-name {
    flex: 1;
    font-size: 15px;
    color: #333;
}
.cat-picker-item.selected .cat-picker-item-name {
    font-weight: 500;
    color: #2563eb;
}
.cat-picker-item-drill {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    flex-shrink: 0;
    border-radius: 4px;
}
.cat-picker-item-drill:hover {
    background: #e5e7eb;
    color: #666;
}
.cat-picker-item-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cat-picker-item.selected .cat-picker-item-radio {
    border-color: #2563eb;
    background: #2563eb;
}
.cat-picker-item-radio-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
}
.cat-picker-item.selected .cat-picker-item-radio-dot {
    opacity: 1;
}

/* 2026-03-10 - Three-dot action menu per category row */
.cat-picker-item-menu {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    flex-shrink: 0;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
}
.cat-picker-item-menu:hover {
    background: #e5e7eb;
    color: #666;
}
.cat-picker-item-count {
    font-size: 12px;
    color: #aaa;
    flex-shrink: 0;
    min-width: 16px;
    text-align: right;
}
/* Action popover */
.cat-action-popover {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 100;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 140px;
    padding: 4px 0;
    margin-top: 2px;
}
.cat-action-popover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}
.cat-action-popover-item:hover {
    background: #f5f5f7;
}
.cat-action-popover-item.destructive {
    color: #e53e3e;
}
.cat-action-popover-item.destructive:hover {
    background: rgba(229, 62, 62, 0.06);
}
.cat-action-popover-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
/* + button in header */
.cat-picker-header-add {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    color: #2563eb;
    flex-shrink: 0;
}
.cat-picker-header-add:hover {
    background: rgba(37, 99, 235, 0.1);
}
.cat-picker-edit-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    background: rgba(37, 99, 235, 0.06);
}
.cat-picker-add-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
    color: #999;
    transition: background 0.1s;
}
.cat-picker-add-row:hover {
    background: #f5f5f7;
    color: #666;
}
.cat-picker-add-row svg {
    width: 16px;
    height: 16px;
}
.cat-picker-add-row span {
    font-size: 14px;
}
.cat-picker-input-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    background: rgba(37, 99, 235, 0.06);
    border-top: 1px solid #f0f0f0;
}
.cat-picker-input {
    flex: 1;
    padding: 8px 10px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #2563eb;
    border-radius: 6px;
    background: #fff;
    outline: none;
}
.cat-picker-input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.cat-picker-input-cancel {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    color: #999;
    background: none;
    border: none;
}
.cat-picker-input-cancel:hover {
    background: #e5e7eb;
    color: #666;
}

/* ========== 2026-03-04 COMBO-BOX (reusable dropdown + add new) ========== */
.combo-box { position: relative; }
.combo-trigger {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #333;
}
.combo-trigger-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.combo-trigger-text.placeholder { color: #999; }
/* 2026-03-04 - Combo panel: sticky toolbar at top, scrollable items */
.combo-panel {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    margin-top: 4px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    max-height: 320px;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    display: none;
    flex-direction: column;
}
.combo-panel.open { display: flex; }
.combo-toolbar {
    flex-shrink: 0;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}
.combo-toolbar-row {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    cursor: pointer;
    gap: 8px;
    font-size: 14px;
    color: #666;
    transition: background 0.1s;
}
.combo-toolbar-row:hover { background: #f0f0f2; }
.combo-toolbar-row + .combo-toolbar-row {
    border-top: 1px solid #f0f0f0;
}
.combo-toolbar-row.none-selected {
    color: #2563eb;
    font-weight: 500;
}
.combo-items-scroll {
    flex: 1;
    overflow-y: auto;
}
.combo-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    gap: 8px;
    font-size: 15px;
    color: #333;
    transition: background 0.1s;
}
.combo-item:hover { background: #f5f5f7; }
.combo-item.selected {
    background: rgba(37, 99, 235, 0.08);
    font-weight: 500;
    color: #2563eb;
}
.combo-item-check {
    width: 16px;
    flex-shrink: 0;
    color: #2563eb;
}
.combo-item-check.hidden { visibility: hidden; }
/* 2026-03-11 - Rename icon on combo items */
.combo-item-rename {
    flex-shrink: 0;
    padding: 2px 4px;
    color: #999;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.combo-item:hover .combo-item-rename { opacity: 1; }
.combo-item-rename:hover { color: #007aff; background: rgba(0,122,255,0.08); }
/* 2026-03-11 - Delete icon on combo items */
.combo-item-delete {
    flex-shrink: 0;
    padding: 2px 4px;
    color: #999;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.combo-item:hover .combo-item-delete { opacity: 1; }
.combo-item-delete:hover { color: #e53e3e; background: rgba(229,62,62,0.08); }
.combo-add-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
    color: #999;
    font-size: 14px;
    transition: background 0.1s;
}
.combo-add-row:hover { background: #f5f5f7; color: #666; }
.combo-input-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    background: rgba(37, 99, 235, 0.06);
    border-top: 1px solid #f0f0f0;
}

.detail-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #666;
}
.detail-edit-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* ========== 2026-03-15 VTABS — reusable vertical tab layout ========== */
/* Usage: .vtabs > .vtabs-nav (buttons) + .vtabs-panels (panels)
   Each button: .vtab[data-meta-tab="name"], panel: .vtab-panel[id]
   Active state: .vtab.active / .vtab-panel.active */

.vtabs {
    display: flex;
    gap: 0;
}

/* Left: vertical nav column — fixed width prevents shift on active change */
.vtabs-nav {
    display: flex;
    flex-direction: column;
    width: 165px;
    flex-shrink: 0;
    border-right: 1px solid rgba(0,0,0,0.08);
    gap: 0;
}

/* Individual tab button */
.vtab {
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    background: none;
    border: none;
    padding: 10px 16px 10px 0;
    cursor: pointer;
    transition: color 0.2s ease;
    text-align: right;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    line-height: 1.4;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

/* 2026-03-15 - Highlight bar on right edge + faint bg for active tab */
.vtab::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: -1px;
    width: 3px;
    border-radius: 2px;
    background: transparent;
    transition: background 0.2s ease;
}
/* 2026-03-15 - Darker highlight with reversed (white) text for active tab */
.vtab.active {
    background: var(--accent-color, #007aff);
    color: #fff;
    border-radius: 6px 0 0 6px;
}
/* 2026-03-15 - No separate bar needed; active bg already highlights */
.vtab.active::after {
    background: transparent;
}

/* Right: content panels */
.vtabs-panels {
    flex: 1;
    padding-left: 50px;
    min-height: 0;
}
.vtab-panel {
    display: none;
}
.vtab-panel.active {
    display: block;
}

/* Scrollable panel variant: pinned header, scrollable body */
.vtab-panel.scrollable.active {
    display: flex;
    flex-direction: column;
    max-height: 50vh;
}
.vtab-panel.scrollable > :first-child {
    flex-shrink: 0;
}
.vtab-panel.scrollable > .panel-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.vtab-panel.scrollable > .panel-scroll::-webkit-scrollbar {
    width: 5px;
}
.vtab-panel.scrollable > .panel-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.vtab-panel.scrollable > .panel-scroll::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 3px;
}

/* Divider between tab groups */
.vtabs-divider {
    height: 1px;
    background: rgba(0,0,0,0.06);
    margin: 6px 16px 6px 0;
}

/* Icon tabs: gray when empty, black when content exists */
.vtab.vtab-icon {
    color: var(--text-tertiary);
}
.vtab-icon.has-content {
    color: var(--text-primary);
}
/* 2026-03-15 - Active icon tabs also get reversed text */
.vtab.vtab-icon.active {
    color: #fff;
}

/* Tab count: inline after label, inherits right-alignment from .vtab */
.vtab-count {
    color: var(--text-tertiary, #999);
    font-weight: 400;
}
/* 2026-03-15 - Count inherits white when tab is active */
.vtab.active .vtab-count {
    color: rgba(255,255,255,0.7);
}


/* ========== 2026-03-15 TEXTAREA EXPAND — reusable expand-to-modal button ========== */
/* Usage: wrap textarea + button in .textarea-wrap, add .textarea-expand-btn to button.
   Button is hidden by default, shown on textarea focus, opens a modal editor. */
.textarea-wrap {
    position: relative;
}
.textarea-expand-btn {
    position: absolute;
    right: 10px;
    top: 8px;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: #c0c0c0;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
}
.textarea-expand-btn.visible {
    display: flex;
}
.textarea-expand-btn:hover {
    color: var(--text-primary, #333);
    background: rgba(0, 0, 0, 0.06);
}
.textarea-expand-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ========== 2026-03-15 FILE BROWSER — reusable thumbnail file list ========== */
/* Usage: set --fb-thumb-size on the container to control thumbnail dimensions.
   Default is 60px (compact). Category manager uses 145px.
   Example: <div class="fb-list" style="--fb-thumb-size: 145px;"> */

.fb-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: #f9f9fb;
    border-radius: 8px;
    flex-wrap: wrap;
}
.fb-row:hover {
    background: #f0f0f2;
}

/* -- Thumbnail (loaded image) -- */
.fb-thumb {
    width: var(--fb-thumb-size, 60px);
    height: var(--fb-thumb-size, 60px);
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: contain;
    background: #eee;
}

/* -- Thumbnail placeholder icon -- */
.fb-thumb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: var(--fb-thumb-size, 60px);
    height: var(--fb-thumb-size, 60px);
    border-radius: 8px;
    flex-shrink: 0;
    background: #eee;
    color: #999;
}
.fb-thumb-icon.pdf     { background: #fde8e8; color: #c0392b; }
.fb-thumb-icon.web     { background: #e8f0fe; color: #1a73e8; }
.fb-thumb-icon.note    { background: #fef9e7; color: #b7950b; }
.fb-thumb-icon.youtube { background: #fce4ec; color: #c0392b; }
.fb-thumb-label {
    font-size: 11px;
    font-weight: 700;
    margin-top: 2px;
}

/* -- Thumbnail wrap (for badge overlay) -- */
.fb-thumb-wrap {
    position: relative;
    width: var(--fb-thumb-size, 60px);
    height: var(--fb-thumb-size, 60px);
    flex-shrink: 0;
}
.fb-thumb-wrap .fb-thumb {
    width: 100%;
    height: 100%;
}
.fb-thumb-badge {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}
.fb-thumb-badge.wiki {
    font-family: 'Linux Libertine', 'Georgia', serif;
    color: #333;
}
.fb-thumb-badge.youtube {
    background: #ff0000;
    color: #fff;
    border-radius: 3px;
    font-size: 9px;
    font-family: system-ui, sans-serif;
}

/* -- File info (name + meta) -- */
.fb-info {
    flex: 1;
    min-width: 0;
}
.fb-name {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
a.fb-name {
    color: #007aff;
    text-decoration: none;
    cursor: pointer;
}
a.fb-name:hover {
    text-decoration: underline;
}
.fb-meta {
    font-size: 12px;
    color: #aaa;
    margin-top: 2px;
}

/* -- Action buttons (download, remove) -- */
.fb-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: #aaa;
    border-radius: 6px;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.fb-action:hover {
    color: #007aff;
    background: rgba(0, 122, 255, 0.08);
}
.fb-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: #aaa;
    border-radius: 6px;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.fb-remove:hover {
    color: #e53e3e;
    background: rgba(229, 62, 62, 0.08);
}

/* -- Empty state -- */
.fb-empty {
    font-size: 13px;
    color: #999;
    padding: 12px 8px;
}
