/* Universal file viewer — the inline "chip" + the preview modal.
   Uses your site's CSS custom properties when present, else falls back to dark-theme defaults.
   Tune the fallback values (after each comma) to match your brand, or define the vars site-wide. */

/* ── inline chip (thumbnail + name + tools) ── */
.ev-file { display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; vertical-align: middle; }
.ev-thumb {
    width: 34px; height: 34px; border-radius: var(--radius-sm, 8px);
    object-fit: cover; border: 1px solid var(--border, #2a3441); background: var(--surface-2, #1b2431);
    cursor: zoom-in; flex: 0 0 auto;
}
.ev-name {
    color: inherit; text-decoration: none; cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch;
}
.ev-name:hover { text-decoration: underline; }
.ev-tools { display: inline-flex; align-items: center; gap: .15rem; flex: 0 0 auto; }
.ev-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0; border-radius: 6px;
    border: 1px solid var(--border, #cbd5e1);
    background: var(--surface-2, #eef2f7); color: var(--text, #334155); cursor: pointer;
    font-size: .9rem; line-height: 1; text-decoration: none;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .12s ease;
}
.ev-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
/* eye (preview) button — brand primary (teal) on hover */
button.ev-btn:hover { background: var(--bs-primary, #006770); border-color: var(--bs-primary, #006770); color: #fff; }
/* download link — brand secondary (bronze) on hover */
a.ev-btn[download]:hover { background: var(--secondary-dark, #8B6F3A); border-color: var(--secondary-dark, #8B6F3A); color: #fff; }
.ev-btn:focus-visible { outline: 2px solid var(--bs-primary, #006770); outline-offset: 1px; }

/* ── floating preview modal ── */
.ev-modal {
    display: none; position: fixed; inset: 0; z-index: 1090;
    background: rgba(2, 6, 23, .6); padding: 3vmin;
    align-items: center; justify-content: center;
}
.ev-modal.show { display: flex; }
.ev-modal-box {
    background: var(--bg-850, #0f172a); color: var(--text, #e5e7eb);
    border: 1px solid var(--border-strong, #334155); border-radius: var(--radius, 14px);
    box-shadow: var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, .5)); width: min(960px, 96vw); max-height: 92vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.ev-modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .6rem .9rem; border-bottom: 1px solid var(--border, #2a3441);
}
.ev-modal-title { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-modal-x {
    border: 0; background: transparent; color: var(--text-dim, #94a3b8);
    font-size: 1.1rem; cursor: pointer; line-height: 1; padding: .2rem .4rem; border-radius: 6px;
}
.ev-modal-x:hover { background: rgba(148, 163, 184, .18); color: var(--text, #e5e7eb); }
.ev-modal-body { padding: .8rem; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: .6rem; }

/* ── per-type preview surfaces ── */
.ev-view-img   { max-width: 100%; max-height: 80vh; border-radius: var(--radius-sm, 8px); }
.ev-view-vid   { max-width: 100%; max-height: 80vh; border-radius: var(--radius-sm, 8px); background: #000; }
.ev-view-frame { width: 100%; height: 78vh; border: 0; border-radius: var(--radius-sm, 8px); background: #fff; }
.ev-view-text {
    width: 100%; max-height: 74vh; overflow: auto; margin: 0;
    padding: .9rem 1rem; border-radius: var(--radius-sm, 8px);
    background: #fff; color: #1f2937; border: 1px solid var(--border, #e2e8f0);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; text-align: start;
}
.ev-view-note  { font-size: .8rem; color: var(--text-dim, #94a3b8); }
.ev-view-fallback { text-align: center; padding: 1.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.ev-view-fallback-ico { font-size: 2.4rem; }
.ev-view-fallback p { margin: 0; color: var(--text-muted, #9aa4b2); max-width: 40ch; }

/* download button used inside the modal fallbacks */
.ev-dl {
    display: inline-flex; align-items: center; gap: .3rem; padding: .45rem .85rem; border-radius: 8px;
    background: var(--bs-primary, #006770); color: #fff; text-decoration: none; font-size: .85rem; font-weight: 600;
}
.ev-dl:hover { filter: brightness(1.08); }
