/* =============================================================
   Escon Drive – Pastas (escon-folders.css)
   ============================================================= */

/* ── Grade genérica (compartilhada entre widgets) ──────────── */
.escon-grid {
    display: grid;
    gap: 1rem;
}
.escon-grid--1 { grid-template-columns: repeat(1, 1fr); }
.escon-grid--2 { grid-template-columns: repeat(2, 1fr); }
.escon-grid--3 { grid-template-columns: repeat(3, 1fr); }
.escon-grid--4 { grid-template-columns: repeat(4, 1fr); }
.escon-grid--5 { grid-template-columns: repeat(5, 1fr); }
.escon-grid--6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1024px) {
    .escon-grid--5,
    .escon-grid--6 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .escon-grid--3,
    .escon-grid--4,
    .escon-grid--5,
    .escon-grid--6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .escon-grid { grid-template-columns: 1fr !important; }
}

/* ── Pasta – card ──────────────────────────────────────────── */
.escon-folder-card {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    position: relative;
    border: 1px solid #f0f0f0;
}

.escon-folder-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    border-color: #e0e0e0;
}

.escon-folder-card.is-open {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* ── Capa ─────────────────────────────────────────────────── */
.escon-folder-card__cover {
    height: 160px;
    overflow: hidden;
    background: #e9ecef;
    position: relative;
}

.escon-folder-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.escon-folder-card:hover .escon-folder-card__cover img {
    transform: scale(1.04);
}

.escon-folder-card__no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #adb5bd;
}

.escon-folder-card__no-cover svg {
    width: 56px;
    height: 56px;
}

/* ── Ícone expand / collapse ───────────────────────────────── */
.escon-folder-card__toggle-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s ease;
}

.escon-folder-card:hover .escon-folder-card__toggle-icon {
    background: rgba(0, 0, 0, 0.65);
}

.escon-folder-card__toggle-icon svg {
    width: 16px;
    height: 16px;
}

.escon-folder-card .escon-icon-collapse { display: none; }
.escon-folder-card.is-open .escon-icon-expand { display: none; }
.escon-folder-card.is-open .escon-icon-collapse { display: block; }

/* ── Rodapé (nome + contagem) ─────────────────────────────── */
.escon-folder-card__info {
    padding: 0.6rem 0.8rem 0.75rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.escon-folder-card__name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.escon-folder-card__count {
    font-size: 0.75rem;
    color: #6c757d;
    flex-shrink: 0;
}

/* ── Área de conteúdo expandida ───────────────────────────── */
.escon-folder-contents {
    grid-column: 1 / -1;
    margin-top: -0.5rem;
    padding: 1rem 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    box-shadow: inset 0 4px 8px -4px rgba(0, 0, 0, 0.06);
}

.escon-folder-contents[hidden] { display: none; }

/* ── Loading ──────────────────────────────────────────────── */
.escon-folder-contents--loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    margin: 2rem auto;
    border: 3px solid #dee2e6;
    border-top-color: #495057;
    border-radius: 50%;
    animation: esconSpin 0.7s linear infinite;
}

@keyframes esconSpin {
    to { transform: rotate(360deg); }
}

/* ── Vídeos – aspect ratio ────────────────────────────────── */
.escon-video-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.escon-aspect-16-9 { padding-top: 56.25%; }
.escon-aspect-4-3  { padding-top: 75%; }
.escon-aspect-1-1  { padding-top: 100%; }

.escon-video-wrapper iframe,
.escon-video-wrapper video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* ── Vídeos – card thumb (clicável → lightbox) ─────────────── */
a.escon-video-thumb {
    display: block;
    text-decoration: none;
    color: inherit;
}

.escon-video-thumb__frame {
    position: relative;
    width: 100%;
    background: #1a1a2e;
    overflow: hidden;
    border-radius: 6px;
}

.escon-video-thumb__frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient( to bottom, transparent 40%, rgba(0,0,0,.65) 100% );
    transition: opacity 0.2s ease;
}

a.escon-video-thumb:hover .escon-video-thumb__frame::after {
    opacity: 0.7;
}

.escon-video-thumb__play {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.escon-video-thumb__play svg {
    width: 48px;
    height: 48px;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.6));
    background: rgba(0,0,0,.45);
    border-radius: 50%;
    padding: 8px;
    transition: transform 0.2s ease, background 0.2s ease;
}

a.escon-video-thumb:hover .escon-video-thumb__play svg {
    transform: scale(1.12);
    background: rgba(0,0,0,.65);
}

.escon-video-thumb__name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* ── Vídeos – grid ────────────────────────────────────────── */
.escon-videos { /* usa .escon-grid */ }

.escon-video-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    transition: box-shadow 0.2s ease;
}

.escon-video-item:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.13);
}

.escon-video-title {
    margin: 0;
    padding: 0.6rem 0.75rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    text-align: center;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

/* ── Único arquivo ────────────────────────────────────────── */
.escon-single figure {
    margin: 0;
}

.escon-single-image img {
    width: 100%;
    height: auto;
    display: block;
}

.escon-single figcaption {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: #6c757d;
    text-align: center;
}

/* ── Mensagem vazia / erro ────────────────────────────────── */
.escon-empty,
.escon-error {
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.escon-empty {
    background: #f8f9fa;
    color: #6c757d;
}

.escon-error {
    background: #fff3f3;
    color: #c0392b;
    border-left: 3px solid #e74c3c;
}
