/* ── FilePicker — Open/Save dialog overlay ── */
.fp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fp-fade-in 0.15s ease-out;
}

@keyframes fp-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fp-dialog {
    width: 660px;
    height: 460px;
    background: #1e1e2e;
    border: 1px solid #45475a;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.03);
    overflow: hidden;
    animation: fp-dialog-in 0.2s ease-out;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 12px;
    color: #cdd6f4;
}

@keyframes fp-dialog-in {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ── Titlebar ── */
.fp-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #181825;
    border-bottom: 1px solid #313244;
    flex-shrink: 0;
    user-select: none;
}

.fp-title {
    font-size: 12px;
    font-weight: 600;
    color: #cdd6f4;
}

.fp-close-btn {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #a6adc8;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    line-height: 1;
}

.fp-close-btn:hover {
    background: #e64553;
    color: #fff;
}

/* ── Navigation bar ── */
.fp-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    background: #1e1e2e;
    border-bottom: 1px solid #313244;
    flex-shrink: 0;
}

.fp-nav-btn {
    width: 28px;
    height: 26px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #a6adc8;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.fp-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: #cdd6f4;
}

.fp-nav-btn:disabled {
    color: #45475a;
    cursor: default;
}

.fp-breadcrumb {
    flex: 1;
    background: #181825;
    border: 1px solid #313244;
    border-radius: 4px;
    padding: 4px 10px;
    color: #a6adc8;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: hidden;
    white-space: nowrap;
    margin-left: 6px;
    min-width: 0;
}

.fp-crumb {
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    color: #89b4fa;
    transition: background 0.12s;
}

.fp-crumb:hover {
    background: rgba(137, 180, 250, 0.12);
}

.fp-crumb:last-child {
    color: #cdd6f4;
    font-weight: 500;
}

.fp-crumb-sep {
    color: #585b70;
    margin: 0 1px;
    font-size: 11px;
    user-select: none;
}

/* ── Body: sidebar + file list ── */
.fp-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ── */
.fp-sidebar {
    width: 150px;
    border-right: 1px solid #313244;
    overflow-y: auto;
    padding: 6px 0;
    flex-shrink: 0;
    background: #181825;
}

.fp-sidebar-label {
    padding: 6px 12px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #585b70;
    font-weight: 600;
    user-select: none;
}

.fp-dir-item {
    padding: 5px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 2px solid transparent;
    transition: background 0.12s;
    font-size: 12px;
}

.fp-dir-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.fp-dir-item.active {
    background: rgba(137, 180, 250, 0.08);
    border-left-color: #89b4fa;
    color: #cdd6f4;
}

.fp-dir-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* ── File list ── */
.fp-files {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.fp-file-item {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    cursor: default;
    gap: 8px;
    border: 1px solid transparent;
    transition: background 0.08s;
    min-height: 28px;
    user-select: none;
}

.fp-file-item:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.fp-file-item:hover {
    background: rgba(205, 214, 244, 0.04);
}

.fp-file-item.fp-selected {
    background: rgba(137, 180, 250, 0.12);
    border-color: rgba(137, 180, 250, 0.25);
}

.fp-file-item.fp-selected:hover {
    background: rgba(137, 180, 250, 0.16);
}

.fp-file-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    line-height: 1;
}

.fp-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fp-file-size {
    color: #7f849c;
    font-size: 11px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ── Empty state ── */
.fp-empty {
    padding: 40px 20px;
    color: #585b70;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.fp-empty-icon {
    font-size: 32px;
    opacity: 0.4;
}

.fp-loading {
    padding: 40px 20px;
    color: #585b70;
    text-align: center;
}

/* ── Footer ── */
.fp-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #181825;
    border-top: 1px solid #313244;
    flex-shrink: 0;
}

.fp-label {
    color: #a6adc8;
    font-size: 12px;
    flex-shrink: 0;
    user-select: none;
}

.fp-filename-input {
    flex: 1;
    background: #11111b;
    border: 1px solid #313244;
    border-radius: 4px;
    padding: 6px 10px;
    color: #cdd6f4;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.fp-filename-input:focus {
    border-color: #89b4fa;
}

.fp-btn {
    padding: 6px 16px;
    border: 1px solid #313244;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s, border-color 0.12s;
}

.fp-action-btn {
    background: #89b4fa;
    color: #1e1e2e;
    border-color: #89b4fa;
    font-weight: 600;
}

.fp-action-btn:hover {
    background: #b4d0fb;
    border-color: #b4d0fb;
}

.fp-cancel-btn {
    background: #313244;
    color: #a6adc8;
}

.fp-cancel-btn:hover {
    background: #45475a;
    color: #cdd6f4;
}

/* ── Scrollbar ── */
.fp-sidebar::-webkit-scrollbar,
.fp-files::-webkit-scrollbar {
    width: 6px;
}

.fp-sidebar::-webkit-scrollbar-track,
.fp-files::-webkit-scrollbar-track {
    background: transparent;
}

.fp-sidebar::-webkit-scrollbar-thumb,
.fp-files::-webkit-scrollbar-thumb {
    background: #313244;
    border-radius: 3px;
}

.fp-sidebar::-webkit-scrollbar-thumb:hover,
.fp-files::-webkit-scrollbar-thumb:hover {
    background: #45475a;
}
