/* --- History Modal --- */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
}

.history-modal.active {
    display: flex;
}

.history-content {
    background: white;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    animation: slideUp 0.3s ease-out;
}

.history-content.closing {
    animation: slideDown 0.3s ease-in forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-sort-select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 13px;
    color: #666;
    background: #fdfdfd;
    outline: none;
    cursor: pointer;
}

.history-sort-select:focus {
    border-color: #3b82f6;
}

.history-header h3 {
    margin: 0;
    color: #333;
}

#closeHistory {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.history-list {
    overflow-y: auto;
    flex: 1;
}

.history-item {
    position: relative;
    overflow: hidden;
    background-color: white;
    touch-action: pan-y;
}

.history-item-content {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    cursor: pointer;
    background: white;
    z-index: 2;
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.history-item-content:active {
    background-color: #f8f8f8;
}

.history-item.swiped-left .history-item-content {
    transform: translateX(-120px);
}

.history-item .entry-name {
    font-weight: 600;
    font-size: 17px;
    color: #333;
}

.history-item .entry-date {
    font-size: 14px;
    color: #666;
}

.swipe-action-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 1;
    cursor: pointer;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.swipe-edit-btn {
    right: 60px;
    background-color: #3b82f6;
}

.swipe-delete-btn {
    right: 0;
    background-color: var(--accent-color);
}