/* ═══════════════════════════════════════════════════════════
   🕐 HISTORICO-PASTA.CSS — mesmo tom dark/vinho do pastaOverlay
   ═══════════════════════════════════════════════════════════ */

/* 🌑 OVERLAY FULLSCREEN */
.hp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483647 !important;
    background: rgba(0, 0, 0, .78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
    animation: hpFadeIn .2s ease;
    isolation: isolate;
}
.hp-overlay.active { display: flex !important; }

@keyframes hpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 🗂️ CARD CENTRAL */
.hp-card {
    background: linear-gradient(145deg, #1a1a1a 0%, #111 100%);
    border: 1px solid #2e2e2e;
    border-radius: 18px;
    padding: 22px 20px;
    width: 540px;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
    animation: hpCardIn .25s ease;
    position: relative;
    z-index: 2147483647 !important;
}
@keyframes hpCardIn {
    from { transform: scale(.92) translateY(12px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* HEADER */
.hp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a;
}
.hp-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ededed;
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.hp-title .hp-icon { font-size: 1.3rem; }
.hp-frame-tag {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #ff7a8a;
    background: rgba(209, 0, 36, .2);
    padding: 3px 10px;
    border-radius: 8px;
}
.hp-close {
    background: none;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color .2s;
}
.hp-close:hover { color: #d10024; }

/* 🖼️ GRID DE IMAGENS */
.hp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    overflow-y: auto;
    padding: 4px;
    flex: 1;
    min-height: 120px;
    transition: opacity .2s ease;
}
.hp-grid::-webkit-scrollbar { width: 8px; }
.hp-grid::-webkit-scrollbar-track { background: #111; border-radius: 8px; }
.hp-grid::-webkit-scrollbar-thumb { background: #5e0010; border-radius: 8px; }
.hp-grid::-webkit-scrollbar-thumb:hover { background: #d10024; }

/* 🖼️ ITEM */
.hp-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #2a2a2a;
    cursor: pointer;
    background: #0d0d0d;
    aspect-ratio: 1 / 1;
    transition: all .2s ease;
}
.hp-item:hover {
    border-color: #d10024;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(209, 0, 36, .35);
}
.hp-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.hp-item-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, .85));
    color: #ccc;
    font-size: .65rem;
    font-weight: 600;
    padding: 12px 6px 5px;
    text-align: center;
}

/* ESTADOS */
.hp-loading, .hp-empty, .hp-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    font-weight: 600;
}
.hp-loading { color: #40e0ff; }
.hp-empty   { color: rgba(255, 255, 255, .5); }
.hp-error   { color: #ff4444; }
.hp-empty small, .hp-error small {
    display: block;
    margin-top: 6px;
    opacity: .7;
    font-weight: 500;
}

/* 📄 PAGINAÇÃO */
.hp-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #2a2a2a;
}
.hp-page-btn {
    background: linear-gradient(135deg, #1c1c1c 0%, #141414 100%);
    border: 1px solid #5e0010;
    color: #d8d8d8;
    font-size: 1rem;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s ease;
}
.hp-page-btn:hover {
    border-color: #d10024;
    background: linear-gradient(135deg, #2a0a10 0%, #1a0608 100%);
    color: #fff;
}
.hp-page-info {
    font-size: .82rem;
    font-weight: 600;
    color: #b0b0b0;
}

/* 📱 MOBILE */
@media (max-width: 600px) {
    .hp-card { width: 96vw; padding: 18px 14px; }
    .hp-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
@media (max-width: 380px) {
    .hp-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════
   📁 BOTÃO PASTA — SEMPRE NA MESMA LINHA (espaço reservado)
   🔧 FIX: troca o "sumir" (display:none) por visibility:hidden,
   assim o botão fica invisível MAS continua ocupando o lugar,
   e nada sobe por cima nem desce. Linha travada em min-height.
   ═══════════════════════════════════════════════════════════ */
.frame-always-buttons {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
    min-height: 44px;            /* 🔑 trava a altura da linha SEMPRE */
}

/* qualquer jeito que o JS use pra esconder vira invisível mas OCUPA o espaço */
.frame-always-buttons .bf-btn.hidden,
.frame-always-buttons .bf-btn.bf-hidden,
.frame-always-buttons .bf-btn[hidden],
.frame-always-buttons .bf-btn[style*="display: none"],
.frame-always-buttons .bf-btn[style*="display:none"] {
    display: inline-flex !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

.frame-always-buttons .bf-btn {
    background: linear-gradient(135deg, #1c1c1c 0%, #121212 100%) !important;
    border: 1px solid #5e0010 !important;
    color: #d8d8d8 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.45) !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: all .22s ease;
}
.frame-always-buttons .bf-btn:hover {
    border-color: #d10024 !important;
    color: #fff !important;
    background: linear-gradient(135deg, #242424 0%, #181818 100%) !important;
    box-shadow: 0 4px 14px rgba(209, 0, 36, .3) !important;
    transform: translateY(-1px);
}
