/* ============================
   BARRA MOBILE FIXA — Premium Glassmorphism
   ============================ */

.ji-mobile-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(26, 26, 46, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(214, 200, 153, 0.15);
    padding: 0;
}

.ji-mobile-bar-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    list-style: none;
}

/* Cada item da barra */
.ji-mobile-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.3px;
    cursor: pointer;
    padding: 6px 16px;
    transition: color 0.25s, transform 0.2s;
    text-decoration: none;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.ji-mobile-bar-item:active {
    transform: scale(0.92);
}

.ji-mobile-bar-item:hover,
.ji-mobile-bar-item.active {
    color: var(--ji-brand, #D6C899);
}

/* Ícone */
.ji-mobile-bar-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s;
}

.ji-mobile-bar-item.active svg {
    transform: translateY(-2px);
}

/* Indicador ativo (bolinha dourada) */
.ji-mobile-bar-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ji-brand, #D6C899);
}

/* Badge de contagem */
.ji-mobile-badge {
    position: absolute;
    top: 0;
    right: 6px;
    background: var(--ji-danger, #ef4444);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.ji-mobile-badge.visible {
    display: flex;
}

/* ============================
   MODAL HISTÓRICO — Slide Up Premium
   ============================ */
.ji-history-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    align-items: flex-end;
    justify-content: center;
}

.ji-history-modal.active {
    display: flex;
}

.ji-history-content {
    background: #ffffff !important;
    color: #1a1a2e !important;
    width: 100%;
    max-width: 500px;
    max-height: 70vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    padding: 0;
    animation: ji-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ji-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Handle bar (indicador visual de arrastar) */
.ji-history-content::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--ji-gray-300, #d1d1d9);
    border-radius: 2px;
    margin: 12px auto 0;
}

/* Header */
.ji-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
}

.ji-history-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e !important;
    margin: 0;
}

.ji-history-close {
    background: #f4f4f7 !important;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #4a4a5a !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ji-history-close:hover {
    background: var(--ji-gray-200, #e8e8ed);
}

/* Lista */
.ji-history-list {
    list-style: none;
    margin: 0;
    padding: 0 20px;
}

.ji-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--ji-gray-100, #f4f4f7);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.ji-history-item:last-child {
    border-bottom: none;
}

.ji-history-item:active {
    background: var(--ji-gray-100, #f4f4f7);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 8px;
}

.ji-history-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--ji-gray-100, #f4f4f7);
}

.ji-history-info {
    flex: 1;
    min-width: 0;
}

.ji-history-info strong {
    display: block;
    font-size: 14px;
    color: #1a1a2e !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.ji-history-info span {
    font-size: 13px;
    color: #b8a76e !important;
    font-weight: 700;
}

/* Ações */
.ji-history-actions {
    display: flex;
    justify-content: center;
    padding: 16px 20px 24px;
}

.ji-btn--clear-history {
    background: none !important;
    border: 1px solid #D6C899 !important;
    color: #b8a76e !important;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.ji-btn--clear-history:hover {
    background: #D6C899 !important;
    color: #1a1a2e !important;
    border-color: #D6C899 !important;
}

.ji-history-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--ji-gray-500, #7a7a8a);
    font-size: 14px;
}

/* ============================
   RESPONSIVO — Exibe no mobile
   ============================ */
@media (max-width: 768px) {
    .ji-mobile-bar {
        display: block;
    }

    .ji-wrapper {
        padding-bottom: 72px;
    }

    /* Sem mobile-bar: remove espaço reservado */
    .ji-wrapper.ji-no-mobile-bar {
        padding-bottom: 0;
    }
}