/*
 * An app's properties panel in the photo editor (js/tools/editor-app-panels.js): the leading choices on top with
 * a ‹ current › picker and a pop-up of their options, the rest in collapsible sections.
 */

/* --- Sections ---------------------------------------------------------------------------------- */

.filter-container .app-panel-section {
    border-top: 1px solid var(--thin-line-color);
}

.filter-container .app-panel-section:last-child {
    border-bottom: 1px solid var(--thin-line-color);
}

.filter-container .app-panel-section[hidden] {
    display: none;
}

.filter-container .app-panel-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    list-style: none;
    cursor: pointer;
    user-select: none;
    color: var(--main-300);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: var(--global-border-radius);
}

.filter-container .app-panel-section-header::-webkit-details-marker {
    display: none;
}

.filter-container .app-panel-section-header:hover {
    background: var(--main-hover);
}

.filter-container .app-panel-section-header:focus-visible {
    outline: 2px solid var(--blue-border);
    outline-offset: -2px;
}

.filter-container .app-panel-section-chevron {
    display: inline-flex;
    transform: rotate(-90deg);
    transition: transform 0.15s ease;
    opacity: 0.8;
}

.filter-container .app-panel-section[open] > .app-panel-section-header .app-panel-section-chevron {
    transform: none;
}

.filter-container .app-panel-section-body {
    padding-bottom: 6px;
}

/* The leading choices: a little room below them before the first section. */
.filter-container .app-panel .app-panel-top + .app-panel-section {
    margin-top: 6px;
}

/* --- Locks: shown on the row being pointed at, or when locked ---------------------------------- */

@media (hover: hover) {
    .filter-container .app-panel .lock-icon:not(.lock-icon-locked):not(.lock-icon--spacer) {
        opacity: 0;
        transition: opacity 0.15s ease;
    }

    .filter-container .app-panel .filter-item:hover .lock-icon:not(.lock-icon-locked):not(.lock-icon--spacer),
    .filter-container .app-panel .lock-icon:focus-visible {
        opacity: 0.6;
    }
}

/* --- Picker: ‹ current › -------------------------------------------------------------------- */

/* The select stays (the app reads it); the picker shows it. */
.filter-container select.app-picker-source {
    display: none;
}

.filter-container .app-picker-row > label {
    flex-wrap: wrap;
    row-gap: 4px;
}

.filter-container .app-picker {
    display: flex;
    align-items: stretch;
    flex: 1 1 160px;
    min-width: 0;
    max-width: 240px;
    margin-left: auto;
    height: 30px;
    border: 1px solid var(--main-400);
    border-radius: var(--global-border-radius);
    background: var(--main-700);
    overflow: hidden;
}

.filter-container .app-picker:hover {
    border-color: var(--blue-border);
}

.filter-container .app-picker button {
    font-family: inherit;
    font-size: var(--fontsize-small);
    color: var(--main-100);
    background: transparent;
    border: 0;
    margin: 0;
    cursor: pointer;
}

.filter-container .app-picker button:hover {
    background: var(--main-hover);
}

.filter-container .app-picker button:focus-visible {
    outline: 2px solid var(--blue-border);
    outline-offset: -2px;
}

.filter-container .app-picker-step {
    flex: 0 0 26px;
    padding: 0;
    font-size: 18px !important;
    line-height: 1;
}

.filter-container .app-picker-current {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 0 4px 0 8px;
    border-left: 1px solid var(--main-600) !important;
    border-right: 1px solid var(--main-600) !important;
}

.filter-container .app-picker-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.filter-container .app-picker-chevron {
    display: inline-flex;
    flex: 0 0 auto;
    opacity: 0.8;
}

/* --- Pop-up of the options ----------------------------------------------------------------------- */

.app-picker-popup {
    position: fixed;
    /* Over the canvas' toolbars and the menu bar (a phone opens it over the canvas), under dialogs. */
    z-index: calc(var(--z-modal) - 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    padding: 8px;
    overflow: hidden;
    color: var(--main-100);
    background: var(--main-800);
    border: 1px solid var(--main-600);
    border-radius: var(--global-border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-family: Mulish, DM Sans, sans-serif;
}

.app-picker-popup input.app-picker-search {
    flex: 0 0 auto;
    width: 100%;
    height: 32px;
    box-sizing: border-box;
    padding: 4px 10px;
    font-size: var(--fontsize-small);
    color: var(--main-100);
    background: var(--main-700);
    border: 1px solid var(--main-600);
    border-radius: var(--global-border-radius);
}

.app-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 6px;
    overflow-y: auto;
    min-height: 0;
    padding: 1px;
}

.app-picker-option {
    min-height: 34px;
    padding: 6px 8px;
    font-family: inherit;
    font-size: var(--fontsize-small);
    line-height: 1.2;
    text-align: left;
    color: var(--main-100);
    background: var(--main-700);
    border: 1px solid var(--main-600);
    border-radius: var(--global-border-radius);
    cursor: pointer;
    overflow-wrap: anywhere;
}

.app-picker-option[hidden] {
    display: none;
}

.app-picker-option:hover {
    background: var(--main-hover);
    border-color: var(--blue-border);
}

.app-picker-option:focus-visible {
    outline: 2px solid var(--blue-border);
    outline-offset: 1px;
}

.app-picker-option.is-selected {
    color: #fff;
    background: var(--blue-600);
    border-color: var(--blue-600);
}

/* --- Loading ----------------------------------------------------------------------------------- */

.filter-container .app-panel-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 8px;
    color: var(--main-200);
    font-size: var(--fontsize-small);
}
