/* The standard large modal (js/panel.js): header with title, search and close; tabs on the left
   (a row on top on mobile); the content on the right. Full screen on mobile. */

.modal-layer[data-type="dialog"] .modal-panel:has(.panel) {
    width: min(760px, calc(100vw - 32px));
    height: min(620px, calc(100dvh - 32px));
    padding: 0;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    min-height: 68px;
    padding: 14px 16px 14px 20px;
    border-bottom: 1px solid var(--surface-raised);
}

.panel-title {
    font-weight: 800;
    font-size: 19px;
}

.panel-search {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding-inline: 14px;
    border-radius: 12px;
    background: var(--surface-raised);
}

.panel-search[hidden] {
    display: block;
    visibility: hidden;
}

.panel-search v-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.panel-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    outline: none;
    user-select: text;
}

.panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.panel-close:active {
    background: var(--surface-raised);
}

.panel-close v-icon {
    width: 16px;
    height: 16px;
}

.panel-body {
    flex: 1;
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 0;
}

.panel.no-tabs .panel-body {
    grid-template-columns: 1fr;
}

.panel.no-tabs .panel-tabs {
    display: none;
}

.panel-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    border-right: 1px solid var(--surface-raised);
}

.panel-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
}

.panel-tab v-icon {
    flex: none;
    width: 16px;
    height: 16px;
}

.panel-tab.active {
    background: var(--surface-raised);
    color: var(--text);
}

.panel-content {
    overflow-y: auto;
    padding: 8px 20px 20px;
    touch-action: pan-y;
}

.panel-heading {
    padding: 14px 0 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* While something runs: no closing and no switching tabs */
.panel.locked .panel-close,
.panel.locked .panel-tab:not(.active) {
    opacity: 0.35;
    pointer-events: none;
}

@media (max-width: 767px), (max-height: 499px) {
    .modal-layer[data-type="dialog"] .modal-panel:has(.panel) {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .panel-head {
        grid-template-columns: 1fr auto;
    }

    .panel-search {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .panel-search[hidden] {
        display: none;
    }

    .panel-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .panel-tabs {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--surface-raised);
    }

    .panel-tab {
        flex: none;
    }

    .panel-content {
        padding-inline: 16px;
    }
}
