/* ─────────────────────────────────────────────────────────────────
   Azure Media Picker — Windows File Explorer aesthetic
   ───────────────────────────────────────────────────────────────── */

/* Overlay / Modal */
.azfe-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 160000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 13px;
}
.azfe-hidden { display: none !important; }

/* ── Window chrome ───────────────────────────────────────────────── */
.azfe-window {
    background: #f3f3f3;
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 28px 64px rgba(0,0,0,.42), 0 0 0 1px rgba(0,0,0,.15);
    overflow: hidden;
    animation: azfe-pop .18s cubic-bezier(.34,1.56,.64,1);
}
@keyframes azfe-pop {
    from { transform: scale(.94); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ── Title bar ───────────────────────────────────────────────────── */
.azfe-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 32px;
    background: #202020;
    color: #fff;
    flex-shrink: 0;
    -webkit-app-region: drag;
}
.azfe-titlebar-left { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.azfe-titlebar-icon { font-size: 14px; }
.azfe-titlebar-title { font-weight: 400; color: #e0e0e0; letter-spacing: .01em; }
.azfe-titlebar-controls { display: flex; gap: 0; }
.azfe-wbtn {
    width: 46px; height: 32px;
    background: transparent; border: none; color: #ccc;
    font-size: 12px; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: background .12s;
    -webkit-app-region: no-drag;
}
.azfe-wbtn-close:hover { background: #c42b1c; color: #fff; }

/* ── Ribbon toolbar ──────────────────────────────────────────────── */
.azfe-ribbon {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    min-height: 52px;
}
.azfe-ribbon-group { display: flex; align-items: center; gap: 2px; }
.azfe-ribbon-separator { width: 1px; height: 36px; background: #ddd; margin: 0 6px; }
.azfe-ribbon-spacer { flex: 1; }

.azfe-ribbon-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 4px 10px; min-width: 52px;
    background: transparent; border: 1px solid transparent; border-radius: 4px;
    cursor: pointer; font-size: 11px; color: #333; gap: 3px;
    transition: background .1s, border-color .1s;
    white-space: nowrap;
}
.azfe-ribbon-btn:hover { background: #e8e8e8; border-color: #c8c8c8; }
.azfe-ribbon-btn:active { background: #d0d0d0; }
.azfe-ribbon-btn.active { background: #d0e4f5; border-color: #6aaddd; }
.azfe-ribbon-icon { font-size: 16px; line-height: 1; }

.azfe-ribbon-btn-insert { background: #0067b8 !important; color: #fff !important; }
.azfe-ribbon-btn-insert:hover:not(:disabled) { background: #005a9e !important; }
.azfe-ribbon-btn-insert:disabled { background: #9ec6e8 !important; cursor: not-allowed; opacity: .7; }
.azfe-ribbon-btn-insert .azfe-ribbon-icon { color: #fff; }

.azfe-ribbon-btn-delete {
    color: #c42b1c;
}
.azfe-ribbon-btn-delete:hover:not(:disabled) {
    background: #fde7e9;
    border-color: #f4acb0;
}
.azfe-ribbon-btn-delete:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.azfe-ribbon-btn-fallback { color: #c42b1c; }
.azfe-ribbon-btn-fallback:hover { background: #fde7e9; border-color: #f4acb0; }

/* ── Navigation bar ──────────────────────────────────────────────── */
.azfe-navbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}
.azfe-nav-arrow {
    width: 28px; height: 28px;
    background: transparent; border: 1px solid transparent; border-radius: 4px;
    cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center;
    color: #555; transition: background .1s;
}
.azfe-nav-arrow:hover:not(:disabled) { background: #e8e8e8; border-color: #ccc; }
.azfe-nav-arrow:disabled { color: #bbb; cursor: default; }

.azfe-address-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    font-size: 12px;
    color: #1a1a1a;
    min-height: 28px;
}
.azfe-addr-icon { font-size: 14px; flex-shrink: 0; }
#azfe-breadcrumb { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.azfe-breadcrumb-link {
    color: #0067b8;
    text-decoration: none;
    font-weight: 600;
}
.azfe-breadcrumb-link:hover { text-decoration: underline; }
.azfe-breadcrumb-sep { color: #888; margin: 0 4px; }

.azfe-search-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    width: 220px;
    min-height: 28px;
    transition: border-color .15s;
}
.azfe-search-wrap:focus-within { border-color: #0067b8; box-shadow: 0 0 0 1px #0067b8; }
.azfe-search-icon { font-size: 13px; color: #888; flex-shrink: 0; }
#azfe-search-input {
    border: none; outline: none; background: transparent;
    font-size: 12px; color: #1a1a1a; flex: 1; min-width: 0;
    font-family: inherit;
}
#azfe-search-input::placeholder { color: #999; }
#azfe-search-clear {
    background: none; border: none; cursor: pointer; color: #888;
    font-size: 11px; padding: 0 2px; line-height: 1;
}
#azfe-search-clear:hover { color: #333; }

/* ── Body (sidebar + content) ────────────────────────────────────── */
/* ── Right Sidebar: Metadata ────────────────────────────────────── */
.azfe-picker-right {
    width: 300px;
    min-width: 300px;
    background: #fcfcfc;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    flex-shrink: 0;
}
.azfe-picker-right.azfe-hidden { display: none !important; }

.azfe-details-title { font-size: 14px; font-weight: 600; color: #1a1a1a; margin-bottom: 12px; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.azfe-detail-group { margin-bottom: 15px; }
.azfe-detail-label { font-size: 11px; font-weight: 600; color: #777; text-transform: uppercase; margin-bottom: 3px; }
.azfe-detail-value { font-size: 13px; color: #333; word-break: break-all; }

.azfe-detail-usage-list { list-style: none; padding: 0; margin: 8px 0 0; }
.azfe-detail-usage-item { font-size: 12px; margin-bottom: 6px; padding: 6px 8px; background: #fff; border: 1px solid #e5e5e5; border-radius: 4px; display: flex; flex-direction: column; align-items: flex-start; }
.azfe-detail-usage-link { color: #0067b8; text-decoration: none; font-size: 11px; font-weight: 600; }
.azfe-detail-usage-link:hover { text-decoration: underline; }
.azfe-detail-usage-loading,
.azfe-detail-usage-empty { font-style: italic; color: #666; }
.azfe-detail-usage-meta { font-size: 11px; color: #666; margin-top: 2px; }

.azfe-detail-preview { width: 100%; height: 160px; background: #eee; border-radius: 4px; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; overflow: hidden; border: 1px solid #ddd; }
.azfe-detail-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.azfe-detail-preview-icon { font-size: 48px; opacity: .3; }

.azfe-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fff;
}

/* Sidebar */
.azfe-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #f9f9f9;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    padding: 8px 0;
}
.azfe-sidebar-section { padding: 0 0 8px; }
.azfe-sidebar-heading {
    padding: 4px 14px 2px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.azfe-sidebar-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    cursor: pointer;
    border-radius: 4px;
    margin: 1px 4px;
    color: #222;
    font-size: 13px;
    transition: background .1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.azfe-sidebar-item:hover { background: #ebebeb; }
.azfe-sidebar-item.active { background: #cce4f7; color: #003d7a; }
.azfe-si-icon { font-size: 14px; flex-shrink: 0; color: #f0d06e; }
.azfe-si-arrow {
    display: inline-block;
    width: 14px;
    height: 14px;
    font-size: 8px;
    line-height: 14px;
    text-align: center;
    color: #888;
    cursor: pointer;
    transition: background .1s;
    border-radius: 2px;
    flex-shrink: 0;
}
.azfe-si-arrow:hover { background: #e0e0e0; color: #333; }
.azfe-si-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.azfe-folder-tree { margin-top: 2px; }
.azfe-folder-children { padding-left: 12px; }
.azfe-sidebar-row { display: flex; flex-direction: column; }

/* Content pane */
.azfe-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    position: relative;
    background: #fff;
    min-width: 0;
}

/* ── Overlay messages (spinner / empty / error) ──────────────────── */
.azfe-overlay-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    color: #666;
    text-align: center;
}
.azfe-fe-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #0067b8;
    border-radius: 50%;
    animation: azfe-spin .8s linear infinite;
    margin-bottom: 14px;
}
@keyframes azfe-spin { to { transform: rotate(360deg); } }
.azfe-empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ── Grid view ───────────────────────────────────────────────────── */
.azfe-blob-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 4px;
    align-content: start;
}
.azfe-blob-grid .azfe-blob-item {
    display: flex; flex-direction: column; align-items: center;
    padding: 6px; border-radius: 4px; cursor: pointer;
    border: 1px solid transparent; transition: background .1s, border-color .1s;
    user-select: none;
}
.azfe-blob-grid .azfe-blob-item:hover { background: #e8f4fd; border-color: #cce4f7; }
.azfe-blob-grid .azfe-blob-item.selected { background: #cce4f7; border-color: #6aaddd; }
.azfe-blob-thumb {
    width: 88px; height: 72px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative; margin-bottom: 5px;
}
.azfe-blob-thumb .azfe-blob-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: none;
    background: rgba(196, 43, 28, .85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    transition: background .1s;
}
.azfe-blob-thumb .azfe-blob-delete:hover {
    background: rgba(196, 43, 28, 1);
}
.azfe-blob-thumb img { width: 100%; height: 100%; object-fit: cover; }
.azfe-file-icon { font-size: 28px; }
.azfe-file-ext {
    position: absolute; bottom: 2px; right: 3px;
    font-size: 9px; font-weight: 700; color: #fff;
    background: rgba(0,0,0,.45); border-radius: 2px; padding: 1px 3px;
    letter-spacing: .03em;
}
.azfe-folder-thumb { font-size: 40px; background: #fff8e0; border-color: #f0d06e; }
.azfe-blob-label {
    font-size: 11.5px; color: #222; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    width: 100%;
}

/* ── List / Details view ─────────────────────────────────────────── */
.azfe-blob-list { display: flex; flex-direction: column; gap: 0; }

.azfe-list-header,
.azfe-blob-list .azfe-list-row {
    display: grid;
    grid-template-columns: 36px 1fr 160px 220px;
    align-items: center;
    gap: 0;
    padding: 3px 6px;
    border-bottom: 1px solid #f0f0f0;
    min-height: 30px;
}
.azfe-list-header {
    background: #f3f3f3;
    border-bottom: 1px solid #ddd;
    position: sticky; top: -12px; z-index: 2;
}
.azfe-col-header {
    font-weight: 600; font-size: 12px; color: #555;
    padding: 4px 8px; cursor: pointer; user-select: none;
    white-space: nowrap;
    display: flex; align-items: center; gap: 4px;
}
.azfe-col-header:hover { color: #0067b8; }

.azfe-blob-list .azfe-blob-item {
    cursor: pointer; transition: background .08s;
    border: 1px solid transparent; border-radius: 2px;
}
.azfe-blob-list .azfe-blob-item:hover { background: #e8f4fd; }
.azfe-blob-list .azfe-blob-item.selected { background: #cce4f7; border-color: #6aaddd; }

.azfe-list-thumb-cell {
    width: 36px; display: flex; align-items: center; justify-content: center;
    font-size: 15px;
}
.azfe-list-thumb-img { width: 28px; height: 22px; object-fit: cover; border-radius: 2px; }
.azfe-list-ext-badge {
    font-size: 8px; font-weight: 700; color: #fff;
    background: #0067b8; border-radius: 2px; padding: 1px 3px;
    white-space: nowrap;
}

.azfe-blob-list .azfe-col-name,
.azfe-blob-list .azfe-col-type,
.azfe-blob-list .azfe-col-url { padding: 0 8px; }
.azfe-blob-list .azfe-col-name { font-size: 12.5px; color: #1a1a1a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.azfe-blob-list .azfe-col-type { font-size: 12px; color: #555; white-space: nowrap; }
.azfe-blob-list .azfe-col-url { font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.azfe-blob-list .azfe-blob-delete {
    margin-left: 6px;
    border: none;
    background: transparent;
    color: #c42b1c;
    font-size: 12px;
    padding: 0;
    cursor: pointer;
}

/* ── Status bar ──────────────────────────────────────────────────── */
.azfe-statusbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 14px;
    background: #f3f3f3;
    border-top: 1px solid #ddd;
    font-size: 11.5px;
    color: #555;
    flex-shrink: 0;
    min-height: 24px;
}
.azfe-status-sep { color: #ccc; }
.azfe-status-sel { color: #0067b8; font-weight: 500; }

/* ── Upload progress list ────────────────────────────────────────── */
.azfe-upload-list {
    margin-bottom: 14px;
    display: flex; flex-direction: column; gap: 6px;
}
.azfe-upload-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 8px 12px;
}
.azfe-upload-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
}
.azfe-upload-filename { font-weight: 500; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.azfe-upload-status { color: #64748b; font-size: 11px; flex-shrink: 0; }
.azfe-upload-track { height: 4px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.azfe-upload-fill { height: 100%; background: #0067b8; border-radius: 99px; transition: width .2s ease, background .15s; width: 0; }

/* ── New Folder Dialog ───────────────────────────────────────────── */
.azfe-dialog {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}
.azfe-dialog-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px 20px;
    width: 320px;
    box-shadow: 0 8px 32px rgba(0,0,0,.28);
}
.azfe-dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: #111; }
.azfe-dialog-desc { font-size: 12.5px; color: #555; margin-bottom: 12px; }
.azfe-dialog-input {
    width: 100%; padding: 7px 10px;
    border: 1px solid #b0b0b0; border-radius: 4px;
    font-size: 13px; font-family: inherit; outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
}
.azfe-dialog-input:focus { border-color: #0067b8; box-shadow: 0 0 0 1px #0067b8; }
.azfe-dialog-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.azfe-dlg-btn {
    padding: 7px 18px; border-radius: 4px;
    font-size: 12.5px; font-family: inherit; cursor: pointer;
    border: 1px solid transparent; transition: background .1s;
}
.azfe-dlg-cancel { background: #f3f3f3; border-color: #c8c8c8; color: #333; }
.azfe-dlg-cancel:hover { background: #e8e8e8; }
.azfe-dlg-ok { background: #0067b8; color: #fff; }
.azfe-dlg-ok:hover { background: #005a9e; }

/* ── Scrollbar styling ───────────────────────────────────────────── */
.azfe-content::-webkit-scrollbar,
.azfe-sidebar::-webkit-scrollbar { width: 8px; }
.azfe-content::-webkit-scrollbar-track,
.azfe-sidebar::-webkit-scrollbar-track { background: transparent; }
.azfe-content::-webkit-scrollbar-thumb,
.azfe-sidebar::-webkit-scrollbar-thumb { background: #c8c8c8; border-radius: 4px; }
.azfe-content::-webkit-scrollbar-thumb:hover,
.azfe-sidebar::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* ── Load More button ────────────────────────────────────────────── */
.azfe-loadmore-wrap {
    display: flex;
    justify-content: center;
    padding: 16px 0 8px;
}

.azfe-loadmore-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 28px;
    background: #fff;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    font-size: 13px;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: #333;
    cursor: pointer;
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.azfe-loadmore-btn:hover:not(:disabled) {
    background: #f0f6ff;
    border-color: #0067b8;
    color: #0067b8;
    box-shadow: 0 1px 4px rgba(0,103,184,.15);
}
.azfe-loadmore-btn:disabled {
    color: #aaa;
    cursor: not-allowed;
}

/* Inline spinner on the Load More button */
.azfe-loadmore-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #0067b8;
    border-radius: 50%;
    animation: azfe-spin .7s linear infinite;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────
   Copy / Move / Usage UI
   ───────────────────────────────────────────────────────────────── */
.azfe-ribbon-btn-copy { color: #0067b8; }
.azfe-ribbon-btn-move { color: #8a2be2; }

.azfe-usage-list {
    margin: 12px 0;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #eee;
    background: #fafafa;
    border-radius: 4px;
    padding: 0;
    list-style: none;
}
.azfe-usage-item {
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.azfe-usage-item:last-child { border-bottom: none; }
.azfe-usage-link { color: #0067b8; text-decoration: none; font-weight: 500; }
.azfe-usage-link:hover { text-decoration: underline; }

.azfe-folder-select-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.azfe-folder-option {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background .1s;
}
.azfe-folder-option:hover { background: #f0f0f0; }
.azfe-folder-option.selected { background: #cce4f7; color: #003d7a; }
.azfe-folder-current {
    background: #f9f9f9;
    border-bottom: 2px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 5;
    font-weight: 600;
}
.azfe-folder-current:hover { background: #e0f0ff; }
.azfe-folder-nav .azfe-si-icon, .azfe-folder-up .azfe-si-icon {
    opacity: 0.7;
    transition: transform 0.2s;
}
.azfe-folder-nav:hover .azfe-si-icon { transform: scale(1.2); opacity: 1; }
.azfe-folder-up:hover .azfe-si-icon { transform: translateX(-3px); opacity: 1; }
