/* ── Container ── */
.spf-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 1.5em 0;
    background: #ffffff;
    position: relative;
}

/* Grid layout: no border / shadow */
.spf-layout-grid {
    border: none;
    box-shadow: none;
}

/* List layout: keep border + shadow */
.spf-layout-list {
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ── Breadcrumb bar ── */
.spf-breadcrumb-bar {
    padding: 10px 16px 8px;
}
.spf-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    font-size: 0.82rem;
}
.spf-crumb {
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 4px;
    color: #0078d4;
    font-weight: 500;
    transition: background 0.13s;
    white-space: nowrap;
}
.spf-crumb:hover { background: #e8f0fe; }
.spf-breadcrumb .spf-crumb:last-child { color: #333; cursor: default; font-weight: 600; }
.spf-breadcrumb .spf-crumb:last-child:hover { background: transparent; }
.spf-sep { color: #aaa; padding: 0 2px; font-size: 0.75rem; }

/* ── Loading ── */
.spf-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 32px 24px;
    color: #666;
    font-size: 0.9rem;
}
.spf-spinner {
    width: 22px; height: 22px;
    border: 3px solid #dde3ea;
    border-top-color: #0078d4;
    border-radius: 50%;
    animation: spf-spin 0.7s linear infinite;
    flex-shrink: 0;
}
.spf-spinner-lg { width: 38px; height: 38px; border-width: 4px; }
@keyframes spf-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   GRID VIEW
══════════════════════════════════════════ */
.spf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    padding: 20px;
    background: #ffffff;
    min-height: 80px;
}


.spf-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
    font-style: italic;
    font-size: 0.9rem;
}
.spf-error { color: #c0392b; font-style: normal; }

/* ── Card ── */
.spf-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1.5px solid #e4e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
    cursor: pointer;
}
.spf-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    border-color: #cdd2da;
    transform: translateY(-3px);
}

/* Card face */
.spf-card-face {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f1f3;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
}

/* Thumbnail image */
.spf-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.22s;
}
.spf-card:hover .spf-thumb-img { transform: scale(1.05); }

/* SVG icon face */
.spf-icon-face {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    box-sizing: border-box;
    background: #f0f1f3;
    transition: background 0.18s;
}
.spf-card:hover .spf-icon-face { background: #e2e4e8; }

.spf-icon-svg {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}
.spf-icon-svg svg { width: 38px; height: 38px; }

.spf-icon-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
}

/* List icon (smaller) */
.spf-li-icon .spf-icon-svg,
.spf-li-icon svg { width: 20px; height: 20px; }

/* Hover overlay */
.spf-card-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.15);
    opacity: 0;
    transition: opacity 0.18s;
}
.spf-card:hover .spf-card-hover-overlay { opacity: 1; }

/* Card footer */
.spf-card-footer {
    padding: 8px 10px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    border-top: 1px solid #f0f2f6;
    background: #ffffff;
    min-height: 38px;
}
.spf-card-name {
    font-size: 0.76rem;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    line-height: 1.3;
}
.spf-card-dl {
    font-size: 0.85rem;
    color: #0078d4;
    text-decoration: none;
    flex-shrink: 0;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.12s;
    line-height: 1;
}
.spf-card-dl:hover { background: #e8f0fe; color: #005a9e; text-decoration: none; }

/* ══════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════ */
body.spf-no-scroll { overflow: hidden; }

.spf-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.86);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.spf-overlay-inner {
    position: relative;
    background: #1a1e24;
    border-radius: 14px;
    padding: 22px;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    box-shadow: 0 28px 90px rgba(0,0,0,0.65);
    min-width: 300px;
}
.spf-overlay-close {
    position: absolute;
    top: 12px; right: 14px;
    background: rgba(255,255,255,0.12);
    border: none; color: #fff;
    width: 32px; height: 32px;
    border-radius: 50%; font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.spf-overlay-close:hover { background: rgba(255,255,255,0.28); }
.spf-overlay-body {
    display: flex; align-items: center; justify-content: center;
    max-width: 80vw; max-height: 70vh; overflow: auto;
}
.spf-preview-img   { max-width: 80vw; max-height: 70vh; object-fit: contain; border-radius: 6px; display: block; }
.spf-preview-frame { width: 75vw; height: 68vh; border: none; border-radius: 6px; background: #fff; }
.spf-preview-video { max-width: 75vw; max-height: 65vh; border-radius: 6px; }
.spf-preview-audio { width: 380px; max-width: 75vw; }
.spf-preview-error { color: #e74c3c; padding: 20px; }
.spf-no-preview { text-align: center; color: #ccc; padding: 24px 32px; }
.spf-no-preview-icon { color: #555; margin-bottom: 12px; display:flex; justify-content:center; }
.spf-no-preview p { margin: 0 0 10px; }
.spf-btn-big {
    display: inline-block; padding: 10px 24px;
    background: #0078d4; color: #fff; border-radius: 6px;
    text-decoration: none; font-size: 0.95rem; font-weight: 600;
    margin-top: 8px; transition: background 0.15s;
}
.spf-btn-big:hover { background: #005a9e; color: #fff; }
.spf-overlay-filename {
    color: #bbb; font-size: 0.85rem;
    max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spf-overlay-download { color: #7bb8f5; font-size: 0.82rem; text-decoration: none; transition: color 0.12s; }
.spf-overlay-download:hover { color: #fff; }

/* ══════════════════════════════════════════
   LIST VIEW
══════════════════════════════════════════ */
.spf-list { background: #ffffff; padding: 0; }

.spf-list-header {
    display: grid;
    grid-template-columns: 1fr 130px 90px 100px;
    align-items: center;
    padding: 8px 16px;
    background: #f4f6f9;
    border-bottom: 2px solid #e4e8f0;
    font-size: 0.72rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    user-select: none;
}

a.spf-list-row {
    display: grid;
    grid-template-columns: 1fr 130px 90px 100px;
    align-items: center;
    padding: 0 16px;
    min-height: 52px;
    border-bottom: 1px solid #f0f2f6;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.12s;
}
a.spf-list-row:last-child { border-bottom: none; }
a.spf-list-row:hover { background: #f0f1f3; text-decoration: none; }

.spf-li-name {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding-right: 12px;
}

.spf-li-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f0f1f3;
    color: #555;
    transition: background 0.12s;
}
.spf-li-icon svg { width: 20px; height: 20px; }
a.spf-list-row:hover .spf-li-icon { background: #e2e4e8; }

.spf-li-thumb {
    width: 36px; height: 36px;
    border-radius: 6px; object-fit: cover;
    flex-shrink: 0; border: 1px solid #e4e8f0;
}

.spf-li-label {
    font-size: 0.875rem; font-weight: 500; color: #1a1a1a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.spf-li-modified, .spf-li-size {
    font-size: 0.8rem; color: #888; white-space: nowrap;
}

.spf-li-actions {
    display: flex; align-items: center; justify-content: flex-end;
    opacity: 0; transition: opacity 0.15s;
}
a.spf-list-row:hover .spf-li-actions { opacity: 1; }

.spf-li-type-badge {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em;
    color: #666; background: #e2e4e8;
    border-radius: 4px; padding: 2px 7px; white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .spf-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; padding: 14px; }
    .spf-icon-svg svg, .spf-icon-svg { width: 30px; height: 30px; }
    .spf-preview-frame { width: 90vw; height: 60vh; }
}
@media (max-width: 600px) {
    .spf-list-header, a.spf-list-row { grid-template-columns: 1fr 80px; }
    .spf-lh-modified, .spf-li-modified, .spf-lh-size, .spf-li-size { display: none; }
    .spf-li-actions { opacity: 1; }
}

/* ══════════════════════════════════════════
   CLEAN CONTAINER CLASS
══════════════════════════════════════════ */
.spf-container.clean-container {
    border: none;
    box-shadow: none;
}

.clean-container .spf-list-header{background:none ;}

/* ══════════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════════ */
.spf-search-bar {
    padding: 12px 16px 10px;
}
.spf-layout-list .spf-search-bar {
    border-bottom: 1px solid #eef0f4;
}

.spf-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 380px;
}

.spf-search-icon {
    position: absolute;
    left: 10px;
    display: flex;
    align-items: center;
    color: #999;
    pointer-events: none;
}
.spf-search-icon svg { width: 16px; height: 16px; }

.spf-search-input {
    width: 100%;
    padding: 8px 34px 8px 34px;
    border: 1.5px solid #e0e4ea;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: #f8f9fb;
    color: #222;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}
.spf-search-input:focus {
    border-color: #0078d4;
    background: #fff;
}
.spf-search-input::placeholder { color: #aaa; }

/* hide browser's native clear button — we use our own */
.spf-search-input::-webkit-search-cancel-button { display: none; }

.spf-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.12s;
}
.spf-search-clear:hover { color: #333; }

.spf-search-empty {
    padding: 24px;
    text-align: center;
    color: #aaa;
    font-style: italic;
}