/* ========================================
   Section Headings (centered with lines)
   ======================================== */

.pv2-section-heading {
    display: flex;
    align-items: center;
    text-align: center;
    gap: 16px;
    font-size: 1.6em;
    line-height: 1.1em;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    padding: 5px 20px;
    margin: 0;
    white-space: nowrap;
}

.pv2-section-heading::before,
.pv2-section-heading::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #d0d0d0;
}

/* ========================================
   Portfolio V2 Toolbar & Management
   ======================================== */

.pv2-toolbar-wrap {
    margin: 0 20px 8px;
}

.pv2-toolbar {
    display: flex;
    align-items: baseline;
    gap: 0;
    padding: 0;
    border-bottom: none;
    font-size: 13px;
}

.pv2-toolbar-toggles {
    display: none;
    align-items: center;
    gap: 6px;
}

.pv2-toolbar-actions {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.pv2-toolbar-sep {
    display: none;
}

.pv2-toolbar-divider {
    color: #ccc;
    font-size: 13px;
    font-weight: 300;
    padding: 0 2px;
    user-select: none;
    flex-shrink: 0;
}

/* Screen-reader-only (visually hidden) */
.pv2-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Menu Links (lightweight toolbar items)
   ======================================== */

.pv2-menu-link {
    display: inline-block;
    background: none;
    border: none;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    padding: 4px 10px;
    white-space: nowrap;
    line-height: 1.2;
}

.pv2-menu-link:hover {
    text-decoration: none;
    color: #333;
}

.pv2-menu-link:focus-visible {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: 2px;
}

.pv2-menu-link.active,
.pv2-menu-trigger.pv2-panel-active {
    color: #000;
    font-weight: bold;
}

.pv2-menu-link.pv2-toggle-only.active {
    font-weight: 400;
    color: #666;
}

/* ========================================
   Menu Panel Items (links inside dropdown panels)
   ======================================== */

.pv2-menu-items {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pv2-menu-item {
    background: none;
    border: none;
    color: var(--wdc-text, #333);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 10px;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.15s ease, color 0.15s ease;
}

.pv2-menu-item:hover {
    background: var(--wdc-accent-light, #e8f0fe);
    color: var(--wdc-accent-text, #1a5fb4);
    text-decoration: none;
}

.pv2-menu-item:focus-visible {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: 2px;
}

.pv2-menu-item.active {
    background: var(--wdc-accent-light, #e8f0fe);
    color: var(--wdc-accent-text, #1a5fb4);
    font-weight: 600;
}

.pv2-menu-sep {
    width: 1px;
    height: 18px;
    background: var(--wdc-border-light, #d0d0d0);
    flex-shrink: 0;
}

/* ========================================
   Buttons
   ======================================== */

.pv2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.pv2-btn:hover {
    text-decoration: none;
}

.pv2-btn:focus-visible {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: 2px;
}

.pv2-btn-primary {
    background: var(--wdc-accent, #4a90d9);
    color: #fff;
    border-color: var(--wdc-accent, #4a90d9);
}

.pv2-btn-primary:hover {
    background: var(--wdc-accent, #3a7bc8);
    border-color: var(--wdc-accent, #3a7bc8);
    color: #fff;
}

.pv2-btn-secondary {
    background: var(--wdc-bg, #fff);
    color: var(--wdc-text-muted, #555);
    border-color: var(--wdc-border-light, #ccc);
}

.pv2-btn-secondary:hover {
    background: #f0f0f0;
    border-color: #999;
    color: var(--wdc-text, #333);
}

.pv2-btn-secondary.active {
    background: var(--wdc-accent-light, #e8f0fe);
    border-color: var(--wdc-accent, #4a90d9);
    color: var(--wdc-accent-text, #1a5fb4);
}

.pv2-btn-danger {
    background: #d45d5d;
    color: #fff;
    border-color: #d45d5d;
}

.pv2-btn-danger:hover {
    background: #c04848;
    border-color: #c04848;
    color: #fff;
}

.pv2-btn-link {
    background: transparent;
    color: var(--wdc-text-muted, #555);
    border-color: transparent;
    padding: 5px 8px;
}

.pv2-btn-link:hover {
    color: var(--wdc-text, #222);
    background: rgba(0,0,0,0.05);
}

.pv2-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   Toggle Pill (Details)
   ======================================== */

.pv2-toggle-btn {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border: 1px solid var(--wdc-border-light, #ccc);
    border-radius: 4px;
    background: var(--wdc-bg, #fff);
    color: var(--wdc-text-muted, #666);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.pv2-toggle-btn:hover {
    border-color: #999;
    color: var(--wdc-text, #333);
}

.pv2-toggle-btn.active {
    background: var(--wdc-accent-light, #e8f0fe);
    border-color: var(--wdc-accent, #4a90d9);
    color: var(--wdc-accent-text, #1a5fb4);
}

/* ========================================
   Select All / Checkbox / Cancel
   ======================================== */

.pv2-toolbar .pv2-checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.pv2-toolbar .pv2-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.pv2-selection-count {
    display: none;
    font-size: 12px;
    color: var(--wdc-text-muted, #666);
    white-space: nowrap;
}

.pv2-bar-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

/* ========================================
   Density Select
   ======================================== */

.pv2-density-select,
.pv2-density-sep {
    display: none;
}

.pv2-density-select {
    padding: 3px 6px;
    border: 1px solid var(--wdc-border-light, #ccc);
    border-radius: 4px;
    background: var(--wdc-bg, #fff);
    font-size: 12px;
    color: var(--wdc-text-muted, #555);
    cursor: pointer;
}

.pv2-density-select:focus {
    border-color: var(--wdc-accent, #4a90d9);
    outline: none;
}

.pv2-density-select:focus-visible {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: 2px;
}

/* ========================================
   Toolbar Inline Panel (Folders / Stats)
   ======================================== */

.pv2-toolbar-panel {
    padding: 8px 12px;
    background: transparent;
    border-bottom: none;
}

.pv2-panel-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pv2-panel-label {
    font-size: 13px;
    color: var(--wdc-text-muted, #555);
    white-space: nowrap;
}

.pv2-panel-select {
    flex: 1;
    min-width: 180px;
    max-width: 400px;
    padding: 5px 8px;
    border: 1px solid var(--wdc-border-light, #ccc);
    border-radius: 4px;
    background: var(--wdc-bg, #fff);
    font-size: 13px;
    color: var(--wdc-text, #333);
    cursor: pointer;
}

.pv2-panel-select:focus {
    border-color: var(--wdc-accent, #4a90d9);
    outline: none;
}

.pv2-panel-select:focus-visible {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: 2px;
}

.pv2-panel-go {
    padding: 5px 14px !important;
    font-size: 13px !important;
}

.pv2-panel-loading {
    padding: 12px 0;
    text-align: center;
    color: var(--wdc-text-muted, #888);
    font-size: 13px;
}

.pv2-view-sub {
    padding-top: 8px;
}

.pv2-search-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pv2-search-input {
    padding: 6px 10px;
    border: 1px solid var(--wdc-border-light, #ccc);
    border-radius: 4px;
    font-size: 13px;
    width: 250px;
    max-width: 100%;
}

.pv2-search-input:focus {
    border-color: var(--wdc-accent, #4a90d9);
    outline: none;
}

.pv2-panel-hint {
    font-size: 13px;
    color: var(--wdc-text-muted, #666);
    text-align: center;
    padding: 6px 0 0;
}

/* ========================================
   Action Trigger Buttons (panel item highlight)
   ======================================== */

.pv2-action-trigger.active,
#pv2-btn-reorder.active {
    background: var(--wdc-accent-light, #e8f0fe);
    color: var(--wdc-accent-text, #1a5fb4);
    font-weight: 600;
}

/* ========================================
   Floating Action Bar
   ======================================== */

.pv2-action-bar {
    position: fixed;
    bottom: -350px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 2147483646;
    transition: bottom 0.3s ease;
}

.pv2-action-bar.visible {
    bottom: 40px;
}

.pv2-action-bar-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pv2-bar-panel {
    display: none;
    align-items: center;
    gap: 12px;
}

.pv2-bar-panel.active {
    display: flex;
}

.pv2-bar-count {
    font-weight: bold;
    white-space: nowrap;
    margin-right: 4px;
}

.pv2-bar-label {
    white-space: nowrap;
    font-size: 13px;
    opacity: 0.85;
}

.pv2-bar-select {
    padding: 6px 10px;
    border: 1px solid #888;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 13px;
    min-width: 160px;
    cursor: pointer;
}

.pv2-bar-select:focus {
    border-color: var(--wdc-accent, #4a90d9);
    outline: none;
}

.pv2-bar-select:focus-visible {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: 2px;
}


.pv2-action-bar .pv2-btn {
    padding: 7px 16px;
    font-weight: 600;
    font-size: 13px;
}

.pv2-bar-cancel {
    color: rgba(255,255,255,0.7) !important;
    margin-left: 4px;
}

.pv2-bar-cancel:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.1) !important;
}

/* Confirmation state hides shared controls */
.pv2-action-bar.confirming > .pv2-action-bar-inner > #pv2-bar-cancel,
.pv2-action-bar.confirming > .pv2-action-bar-inner > .pv2-bar-select-all,
.pv2-action-bar.confirming > .pv2-action-bar-inner > .pv2-bar-count {
    display: none;
}

.pv2-confirm-message {
    font-size: 13px;
    line-height: 1.4;
    max-width: 360px;
}

/* ========================================
   Item Checkboxes & Order Inputs
   ======================================== */

/* Hidden by default (browse mode) */
.pv2-entry-checkbox-wrap {
    display: none;
    align-items: flex-start;
    padding: 7px 10px 0 5px;
}

.pv2-entry-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.pv2-entry-order-wrap {
    display: none;
    padding: 5px 10px 0 5px;
}

.pv2-entry-order {
    width: 50px;
    padding: 4px 6px;
    border: 2px solid #999;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

.pv2-entry-order:focus {
    border-color: var(--wdc-accent, #4a90d9);
    outline: none;
}

.pv2-entry-order:focus-visible {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: 2px;
}

.pv2-entry-order.pv2-changed {
    border-color: #e8a840;
    background: #fef9ee;
}

/* Select mode: show checkboxes */
.pv2-select-mode .pv2-entry-checkbox-wrap {
    display: flex !important;
}

/* Reorder mode: show order inputs, hide checkboxes */
.pv2-reorder-mode .pv2-entry-checkbox-wrap {
    display: none !important;
}

.pv2-reorder-mode .pv2-entry-order-wrap {
    display: flex !important;
}

/* Selected item highlight */
.pv2-item-selected {
    outline: 2px solid var(--wdc-accent, #4a90d9);
    outline-offset: -2px;
}

/* ========================================
   Density Variants
   ======================================== */

.pv2-density-compact .portlet {
    margin: 2px 0 !important;
}

.pv2-density-compact .portlet > div {
    padding-top: 5px !important;
    padding-bottom: 3px !important;
}

.pv2-density-comfortable .portlet {
    margin: 8px 0 !important;
}

.pv2-density-comfortable .portlet > div {
    padding-top: 14px !important;
    padding-bottom: 10px !important;
}

/* ========================================
   Loading / Status
   ======================================== */

.pv2-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2147483647;
    background: var(--wdc-accent, #4a90d9);
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
    transform: translateY(-100%);
    transition: transform 0.2s ease;
}

.pv2-loading.visible {
    transform: translateY(0);
}

.pv2-status-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483647;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    animation: pv2-toast-in 0.25s ease;
}

.pv2-status-success {
    background: #1e7e45;
}

.pv2-status-error {
    background: #c0392b;
}

@keyframes pv2-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Mobile Create / Desktop Create defaults
   ======================================== */

.pv2-mobile-create {
    display: none;
}

.pv2-mobile-details {
    display: none;
}

/* ========================================
   Button row (Apply + Cancel side-by-side)
   ======================================== */

.pv2-bar-btn-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pv2-bar-cancel-inline {
    display: none;
}

/* ========================================
   Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .pv2-btn,
    .pv2-toggle-btn,
    .pv2-menu-item,
    .pv2-action-bar,
    .pv2-loading,
    .pv2-status-toast {
        transition: none !important;
        animation: none !important;
    }
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 600px) {

    /* --- Issue 1: Hide hover-reveal gear/binoculars on mobile --- */
    .portlet [id^="toolsImg"],
    .portlet [id^="detailsImg"] {
        display: none !important;
    }

    /* --- Issue 2: Toolbar on mobile matches desktop layout --- */
    .pv2-toolbar-wrap {
        margin-left: 10px;
        margin-right: 10px;
    }

    .pv2-toolbar-actions .pv2-menu-link {
        font-size: 13px;
        padding: 5px 6px 8px;
        flex-shrink: 0;
    }

    .pv2-toolbar-actions .pv2-toolbar-divider {
        padding: 0 1px;
    }

    .pv2-search-input {
        width: 150px;
    }

    .pv2-selection-count {
        display: none;
    }

    /* --- Floating action bars on mobile --- */
    .pv2-action-bar {
        left: 8px;
        right: 8px;
        transform: none;
        width: auto;
        padding: 10px 14px;
    }

    .pv2-action-bar.visible {
        bottom: 12px;
    }

    /* Save bar (Reorder): compact 2-row layout */
    #pv2-save-bar .pv2-action-bar-inner {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    #pv2-save-bar .pv2-bar-count {
        width: 100%;
        text-align: center;
        font-size: 12px;
        margin: 0;
    }

    #pv2-save-bar .pv2-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Action bar (Select mode): top row horizontal, panels below */
    #pv2-action-bar .pv2-action-bar-inner {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    #pv2-action-bar .pv2-bar-select-all {
        font-size: 13px;
    }

    #pv2-action-bar .pv2-bar-count {
        font-size: 12px;
        margin-right: 0;
    }

    .pv2-bar-panel {
        flex-basis: 100%;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .pv2-bar-select {
        width: 100%;
        min-width: 0;
    }

    /* Show inline cancel, hide outer cancel on mobile */
    .pv2-bar-cancel-inline {
        display: inline-flex;
    }

    #pv2-bar-cancel {
        display: none;
    }

    .pv2-bar-btn-row {
        width: 100%;
    }

    .pv2-bar-btn-row .pv2-btn {
        flex: 1;
    }

    .pv2-confirm-message {
        text-align: center;
        max-width: none;
    }

    /* Toolbar panel on mobile */
    .pv2-menu-items {
        gap: 6px;
    }

    .pv2-menu-sep {
        display: none;
    }

    .pv2-panel-select {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .pv2-panel-label {
        width: 100%;
    }

}

/* ========================================
   V2 Search Results
   ======================================== */

.pv2-search-header {
    font-size: 13px;
    color: #666;
    padding: 8px 0 6px;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 8px;
}

.pv2-search-header.pv2-search-empty {
    text-align: center;
    font-size: 14px;
    color: #888;
    padding: 20px 0;
    border-bottom: none;
}

.pv2-search-wrap {
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#pv2-search-results {
    padding-bottom: 12px;
    margin-bottom: 20px;
    position: relative;
}

#pv2-search-results::after {
    content: '';
    display: block;
    position: relative;
    left: -20px;
    width: calc(100% + 40px);
    border-bottom: 1px solid #d0d0d0;
    margin-top: 5px;
}

#pv2-search-results .shadowBox {
    background-color: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
    margin: 0 0 6px 0 !important;
    padding: 3px !important;
}

#pv2-search-results div[id^="portContentItem"] {
    margin-bottom: 6px !important;
}

#pv2-search-results .portlet {
    margin: 0 !important;
    padding: 6px 3px !important;
    background-color: #fff !important;
}

#pv2-search-results .portlet > div {
    background-color: #fff !important;
}

#pv2-search-results ul.sortable {
    margin: 0;
    padding: 0;
    list-style: none;
}

#pv2-search-results .noSelect {
    padding: 0 !important;
}
